summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-11-03 06:48:56 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-11-03 06:48:56 (GMT)
commitee259b6c04cf4296f45eed31c4d3c5c195fc0924 (patch)
tree67645a557da11167e225704740e7a8aa928b5ee7 /src/declarative
parent79d35acae62bf28c37022b763b04e94f5e67bf6f (diff)
parent7bc853890bbd8653c3d058d50811ae6dfaad1fd1 (diff)
downloadQt-ee259b6c04cf4296f45eed31c4d3c5c195fc0924.zip
Qt-ee259b6c04cf4296f45eed31c4d3c5c195fc0924.tar.gz
Qt-ee259b6c04cf4296f45eed31c4d3c5c195fc0924.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/extra/qmlgraphicsanimatedimageitem.cpp48
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsflickable.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsfocuspanel.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsfocusscope.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsgridview.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsimage.cpp14
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsimage_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitem.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicslistview.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsloader.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsmouseregion.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspath.cpp12
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspathview.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspositioners.cpp23
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsrepeater.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstextedit.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstextinput.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicswebview.cpp2
-rw-r--r--src/declarative/qml/qmlcontext.cpp16
-rw-r--r--src/declarative/qml/qmlcontext_p.h3
-rw-r--r--src/declarative/qml/qmlvaluetype.cpp60
-rw-r--r--src/declarative/qml/qmlvaluetype_p.h39
-rw-r--r--src/declarative/util/qmlstategroup.cpp85
-rw-r--r--src/declarative/util/qmltimer.cpp19
24 files changed, 284 insertions, 63 deletions
diff --git a/src/declarative/extra/qmlgraphicsanimatedimageitem.cpp b/src/declarative/extra/qmlgraphicsanimatedimageitem.cpp
index 5dbffc0..f3c2058 100644
--- a/src/declarative/extra/qmlgraphicsanimatedimageitem.cpp
+++ b/src/declarative/extra/qmlgraphicsanimatedimageitem.cpp
@@ -40,7 +40,6 @@
****************************************************************************/
#include <QMovie>
-#include <QtDeclarative/qmlcontext.h>
#include <QtDeclarative/qmlengine.h>
#include "qmlgraphicsanimatedimageitem_p.h"
#include "qmlgraphicsanimatedimageitem_p_p.h"
@@ -179,6 +178,14 @@ int QmlGraphicsAnimatedImageItem::frameCount() const
return d->_movie->frameCount();
}
+static QString toLocalFileOrQrc(const QUrl& url)
+{
+ QString r = url.toLocalFile();
+ if (r.isEmpty() && url.scheme() == QLatin1String("qrc"))
+ r = QLatin1Char(':') + url.path();
+ return r;
+}
+
void QmlGraphicsAnimatedImageItem::setSource(const QUrl &url)
{
Q_D(QmlGraphicsAnimatedImageItem);
@@ -193,15 +200,46 @@ void QmlGraphicsAnimatedImageItem::setSource(const QUrl &url)
d->reply = 0;
}
- d->url = qmlContext(this)->resolvedUrl(url);
+ d->url = url;
if (url.isEmpty()) {
delete d->_movie;
d->status = Null;
} else {
+#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML
+ QString lf = toLocalFileOrQrc(url);
+ if (!lf.isEmpty()) {
+ //### should be unified with movieRequestFinished
+ d->_movie = new QMovie(lf);
+ if (!d->_movie->isValid()){
+ qWarning() << "Error Reading Animated Image File " << d->url;
+ delete d->_movie;
+ d->_movie = 0;
+ return;
+ }
+ connect(d->_movie, SIGNAL(stateChanged(QMovie::MovieState)),
+ this, SLOT(playingStatusChanged()));
+ connect(d->_movie, SIGNAL(frameChanged(int)),
+ this, SLOT(movieUpdate()));
+ d->_movie->setCacheMode(QMovie::CacheAll);
+ if(d->playing)
+ d->_movie->start();
+ else
+ d->_movie->jumpToFrame(0);
+ if(d->paused)
+ d->_movie->setPaused(true);
+ d->setPixmap(d->_movie->currentPixmap());
+ d->status = Ready;
+ d->progress = 1.0;
+ emit statusChanged(d->status);
+ emit sourceChanged(d->url);
+ emit progressChanged(d->progress);
+ return;
+ }
+#endif
d->status = Loading;
QNetworkRequest req(d->url);
- d->reply = qmlContext(this)->engine()->networkAccessManager()->get(req);
+ d->reply = qmlEngine(this)->networkAccessManager()->get(req);
QObject::connect(d->reply, SIGNAL(finished()),
this, SLOT(movieRequestFinished()));
}
@@ -230,13 +268,13 @@ void QmlGraphicsAnimatedImageItem::movieRequestFinished()
d->_movie->jumpToFrame(0);
if(d->paused)
d->_movie->setPaused(true);
- setPixmap(d->_movie->currentPixmap());
+ d->setPixmap(d->_movie->currentPixmap());
}
void QmlGraphicsAnimatedImageItem::movieUpdate()
{
Q_D(QmlGraphicsAnimatedImageItem);
- setPixmap(d->_movie->currentPixmap());
+ d->setPixmap(d->_movie->currentPixmap());
emit frameChanged();
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp
index 8895977..19c5abc 100644
--- a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp
@@ -344,7 +344,7 @@ void QmlGraphicsFlickablePrivate::updateBeginningEnd()
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Flickable,QmlGraphicsFlickable)
/*!
- \qmlclass Flickable QFxFlickable
+ \qmlclass Flickable QmlGraphicsFlickable
\brief The Flickable item provides a surface that can be "flicked".
\inherits Item
diff --git a/src/declarative/graphicsitems/qmlgraphicsfocuspanel.cpp b/src/declarative/graphicsitems/qmlgraphicsfocuspanel.cpp
index d3ee184..a19e355 100644
--- a/src/declarative/graphicsitems/qmlgraphicsfocuspanel.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsfocuspanel.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,FocusPanel,QmlGraphicsFocusPanel)
/*!
- \qmlclass FocusPanel QFxFocusPanel
+ \qmlclass FocusPanel QmlGraphicsFocusPanel
\brief The FocusPanel item explicitly creates a focus panel.
\inherits Item
diff --git a/src/declarative/graphicsitems/qmlgraphicsfocusscope.cpp b/src/declarative/graphicsitems/qmlgraphicsfocusscope.cpp
index cd30b2b..f03e3f1 100644
--- a/src/declarative/graphicsitems/qmlgraphicsfocusscope.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsfocusscope.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,FocusScope,QmlGraphicsFocusScope)
/*!
- \qmlclass FocusScope QFxFocusScope
+ \qmlclass FocusScope QmlGraphicsFocusScope
\brief The FocusScope object explicitly creates a focus scope.
\inherits Item
diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
index cadd650..1ee4511 100644
--- a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
@@ -658,7 +658,7 @@ void QmlGraphicsGridViewPrivate::updateCurrent(int modelIndex)
//----------------------------------------------------------------------------
/*!
- \qmlclass GridView QFxGridView
+ \qmlclass GridView QmlGraphicsGridView
\inherits Flickable
\brief The GridView item provides a grid view of items provided by a model.
diff --git a/src/declarative/graphicsitems/qmlgraphicsimage.cpp b/src/declarative/graphicsitems/qmlgraphicsimage.cpp
index fd220a3..938fe2a 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimage.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsimage.cpp
@@ -152,12 +152,18 @@ void QmlGraphicsImage::setPixmap(const QPixmap &pix)
Q_D(QmlGraphicsImage);
if (!d->url.isEmpty())
return;
- d->pix = pix;
+ d->setPixmap(pix);
+}
+
+void QmlGraphicsImagePrivate::setPixmap(const QPixmap &pixmap)
+{
+ Q_Q(QmlGraphicsImage);
+ pix = pixmap;
- setImplicitWidth(d->pix.width());
- setImplicitHeight(d->pix.height());
+ q->setImplicitWidth(pix.width());
+ q->setImplicitHeight(pix.height());
- update();
+ q->update();
}
/*!
diff --git a/src/declarative/graphicsitems/qmlgraphicsimage_p_p.h b/src/declarative/graphicsitems/qmlgraphicsimage_p_p.h
index 62a4d1e..f6b4e51 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimage_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsimage_p_p.h
@@ -69,7 +69,7 @@ public:
}
QmlGraphicsImage::FillMode fillMode;
-
+ void setPixmap(const QPixmap &pix);
};
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.cpp b/src/declarative/graphicsitems/qmlgraphicsitem.cpp
index 0e741c4..5083f43 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitem.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsitem.cpp
@@ -2918,5 +2918,5 @@ QML_DECLARE_TYPE(QmlGraphicsKeysAttached)
QML_DECLARE_TYPEINFO(QmlGraphicsKeysAttached, QML_HAS_ATTACHED_PROPERTIES)
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Keys,QmlGraphicsKeysAttached)
QML_DECLARE_TYPE(QmlGraphicsKeyNavigationAttached)
+QML_DECLARE_TYPEINFO(QmlGraphicsKeyNavigationAttached, QML_HAS_ATTACHED_PROPERTIES)
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,KeyNavigation,QmlGraphicsKeyNavigationAttached)
-
diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp
index cf399f9..a393cb1 100644
--- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp
@@ -954,7 +954,7 @@ void QmlGraphicsListViewPrivate::flickY(qreal velocity)
//----------------------------------------------------------------------------
/*!
- \qmlclass ListView QFxListView
+ \qmlclass ListView QmlGraphicsListView
\inherits Flickable
\brief The ListView item provides a list view of items provided by a model.
diff --git a/src/declarative/graphicsitems/qmlgraphicsloader.cpp b/src/declarative/graphicsitems/qmlgraphicsloader.cpp
index 65753d8..4d463ab 100644
--- a/src/declarative/graphicsitems/qmlgraphicsloader.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsloader.cpp
@@ -56,7 +56,7 @@ QmlGraphicsLoaderPrivate::~QmlGraphicsLoaderPrivate()
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Loader,QmlGraphicsLoader)
/*!
- \qmlclass Loader QFxLoader
+ \qmlclass Loader QmlGraphicsLoader
\inherits Item
\brief The Loader item allows dynamically loading an Item-based
diff --git a/src/declarative/graphicsitems/qmlgraphicsmouseregion.cpp b/src/declarative/graphicsitems/qmlgraphicsmouseregion.cpp
index 75e31b8..1a57062 100644
--- a/src/declarative/graphicsitems/qmlgraphicsmouseregion.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsmouseregion.cpp
@@ -120,7 +120,7 @@ void QmlGraphicsDrag::setYmax(qreal m)
}
/*!
- \qmlclass MouseRegion QFxMouseRegion
+ \qmlclass MouseRegion QmlGraphicsMouseRegion
\brief The MouseRegion item enables simple mouse handling.
\inherits Item
diff --git a/src/declarative/graphicsitems/qmlgraphicspath.cpp b/src/declarative/graphicsitems/qmlgraphicspath.cpp
index c0e6caf..ed0dfaa 100644
--- a/src/declarative/graphicsitems/qmlgraphicspath.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspath.cpp
@@ -57,7 +57,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathQuad,QmlGraphicsPathQuad)
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathCubic,QmlGraphicsPathCubic)
/*!
- \qmlclass PathElement QFxPathElement
+ \qmlclass PathElement QmlGraphicsPathElement
\brief PathElement is the base path type.
This type is the base for all path types. It cannot
@@ -464,7 +464,7 @@ void QmlGraphicsCurve::setY(qreal y)
/****************************************************************************/
/*!
- \qmlclass PathAttribute QFxPathAttribute
+ \qmlclass PathAttribute QmlGraphicsPathAttribute
\brief The PathAttribute allows setting an attribute at a given position in a Path.
The PathAttribute object allows attibutes consisting of a name and
@@ -543,7 +543,7 @@ void QmlGraphicsPathAttribute::setValue(qreal value)
/****************************************************************************/
/*!
- \qmlclass PathLine QFxPathLine
+ \qmlclass PathLine QmlGraphicsPathLine
\brief The PathLine defines a straight line.
The example below creates a path consisting of a straight line from
@@ -583,7 +583,7 @@ void QmlGraphicsPathLine::addToPath(QPainterPath &path)
/****************************************************************************/
/*!
- \qmlclass PathQuad QFxPathQuad
+ \qmlclass PathQuad QmlGraphicsPathQuad
\brief The PathQuad defines a quadratic Bezier curve with a control point.
The following QML produces the path shown below:
@@ -667,7 +667,7 @@ void QmlGraphicsPathQuad::addToPath(QPainterPath &path)
/****************************************************************************/
/*!
- \qmlclass PathCubic QFxPathCubic
+ \qmlclass PathCubic QmlGraphicsPathCubic
\brief The PathCubic defines a cubic Bezier curve with two control points.
The following QML produces the path shown below:
@@ -777,7 +777,7 @@ void QmlGraphicsPathCubic::addToPath(QPainterPath &path)
/****************************************************************************/
/*!
- \qmlclass PathPercent QFxPathPercent
+ \qmlclass PathPercent QmlGraphicsPathPercent
\brief The PathPercent manipulates the way a path is interpreted.
The examples below show the normal distrubution of items along a path
diff --git a/src/declarative/graphicsitems/qmlgraphicspathview.cpp b/src/declarative/graphicsitems/qmlgraphicspathview.cpp
index 52d2fa9..d2a9be1 100644
--- a/src/declarative/graphicsitems/qmlgraphicspathview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspathview.cpp
@@ -97,7 +97,7 @@ private:
*/
/*!
- \qmlclass PathView QFxPathView
+ \qmlclass PathView QmlGraphicsPathView
\brief The PathView element lays out model-provided items on a path.
\inherits Item
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
index ba696e7..f599025 100644
--- a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
@@ -333,7 +333,7 @@ void QmlGraphicsBasePositioner::applyRemove(const QList<QPair<QString, QVariant>
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Column,QmlGraphicsColumn)
/*!
- \qmlclass Column QFxColumn
+ \qmlclass Column QmlGraphicsColumn
\brief The Column item lines up its children vertically.
\inherits Item
@@ -481,6 +481,11 @@ QmlGraphicsColumn::QmlGraphicsColumn(QmlGraphicsItem *parent)
{
}
+inline bool isInvisible(QmlGraphicsItem *child)
+{
+ return child->opacity() == 0.0 || !child->isVisible() || !child->width() || !child->height();
+}
+
void QmlGraphicsColumn::doPositioning()
{
int voffset = 0;
@@ -495,7 +500,7 @@ void QmlGraphicsColumn::doPositioning()
QList<QGraphicsItem *> children = childItems();
for (int ii = 0; ii < children.count(); ++ii) {
QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(children.at(ii));
- if (!child || child->opacity() == 0.0)
+ if (!child || isInvisible(child))
continue;
bool needMove = (child->y() != voffset || child->x());
@@ -519,7 +524,7 @@ void QmlGraphicsColumn::doPositioning()
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Row,QmlGraphicsRow)
/*!
- \qmlclass Row QFxRow
+ \qmlclass Row QmlGraphicsRow
\brief The Row item lines up its children horizontally.
\inherits Item
@@ -651,7 +656,7 @@ void QmlGraphicsRow::doPositioning()
QList<QGraphicsItem *> children = childItems();
for (int ii = 0; ii < children.count(); ++ii) {
QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(children.at(ii));
- if (!child || child->opacity() == 0.0)
+ if (!child || isInvisible(child))
continue;
bool needMove = (child->x() != hoffset || child->y());
@@ -668,10 +673,8 @@ void QmlGraphicsRow::doPositioning()
child->setX(hoffset);
setMovingItem(0);
}
- if(child->width() && child->height()){//don't advance for invisible children
- hoffset += child->width();
- hoffset += spacing();
- }
+ hoffset += child->width();
+ hoffset += spacing();
}
}
@@ -867,7 +870,7 @@ void QmlGraphicsGrid::doPositioning()
if (childIndex == children.count())
continue;
QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(children.at(childIndex++));
- if (!child || child->opacity() == 0.0)
+ if (!child || isInvisible(child))
continue;
if (child->width() > maxColWidth[j])
maxColWidth[j] = child->width();
@@ -888,7 +891,7 @@ void QmlGraphicsGrid::doPositioning()
}
foreach(QGraphicsItem* schild, children){
QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(schild);
- if (!child || child->opacity() == 0.0)
+ if (!child || isInvisible(child))
continue;
bool needMove = (child->x()!=xoffset)||(child->y()!=yoffset);
QList<QPair<QString, QVariant> > changes;
diff --git a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp
index ba860e9..646374f 100644
--- a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp
@@ -59,7 +59,7 @@ QmlGraphicsRepeaterPrivate::~QmlGraphicsRepeaterPrivate()
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Repeater,QmlGraphicsRepeater)
/*!
- \qmlclass Repeater QFxRepeater
+ \qmlclass Repeater QmlGraphicsRepeater
\inherits Item
\brief The Repeater item allows you to repeat a component based on a model.
diff --git a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp
index 0c81dca..13df329 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,TextEdit,QmlGraphicsTextEdit)
/*!
- \qmlclass TextEdit QFxTextEdit
+ \qmlclass TextEdit QmlGraphicsTextEdit
\brief The TextEdit item allows you to add editable formatted text to a scene.
It can display both plain and rich text. For example:
diff --git a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp b/src/declarative/graphicsitems/qmlgraphicstextinput.cpp
index 44ccda1..9a4f627 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicstextinput.cpp
@@ -54,7 +54,7 @@ QML_DEFINE_NOCREATE_TYPE(QValidator);
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QIntValidator,QIntValidator);
/*!
- \qmlclass TextInput QFxTextInput
+ \qmlclass TextInput QmlGraphicsTextInput
The TextInput item allows you to add an editable line of text to a scene.
TextInput can only display a single line of text, and can only display
diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp
index c6ab4c7..d1da0f2 100644
--- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp
@@ -208,7 +208,7 @@ public:
};
/*!
- \qmlclass WebView QFxWebView
+ \qmlclass WebView QmlGraphicsWebView
\brief The WebView item allows you to add web content to a canvas.
\inherits Item
diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp
index d37d959..f8e685a 100644
--- a/src/declarative/qml/qmlcontext.cpp
+++ b/src/declarative/qml/qmlcontext.cpp
@@ -88,18 +88,6 @@ void QmlContextPrivate::addScript(const QString &script, QObject *scopeObject,
scripts.append(scope);
}
-void QmlContextPrivate::dump()
-{
- dump(0);
-}
-
-void QmlContextPrivate::dump(int depth)
-{
- QByteArray ba(depth * 4, ' ');
- if (parent)
- parent->d_func()->dump(depth + 1);
-}
-
void QmlContextPrivate::destroyed(ContextGuard *guard)
{
Q_Q(QmlContext);
@@ -382,8 +370,8 @@ void QmlContext::setContextProperty(const QString &name, const QVariant &value)
if (d->notifyIndex == -1)
d->notifyIndex = this->metaObject()->methodCount();
- if (QmlMetaType::isObject(value.userType())) {
- QObject *o = QmlMetaType::toQObject(value);
+ if (d->engine && QmlEnginePrivate::get(d->engine)->isObject(value.userType())) {
+ QObject *o = *(QObject **)value.constData();
setContextProperty(name, o);
} else {
diff --git a/src/declarative/qml/qmlcontext_p.h b/src/declarative/qml/qmlcontext_p.h
index cc8fcc6..7f9be0f 100644
--- a/src/declarative/qml/qmlcontext_p.h
+++ b/src/declarative/qml/qmlcontext_p.h
@@ -101,9 +101,6 @@ public:
void init();
- void dump();
- void dump(int depth);
-
void invalidateEngines();
void refreshExpressions();
QSet<QmlContext *> childContexts;
diff --git a/src/declarative/qml/qmlvaluetype.cpp b/src/declarative/qml/qmlvaluetype.cpp
index 1713205..859a93a 100644
--- a/src/declarative/qml/qmlvaluetype.cpp
+++ b/src/declarative/qml/qmlvaluetype.cpp
@@ -521,6 +521,16 @@ void QmlFontValueType::setBold(bool b)
font.setBold(b);
}
+QmlFontValueType::FontWeight QmlFontValueType::weight() const
+{
+ return (QmlFontValueType::FontWeight)font.weight();
+}
+
+void QmlFontValueType::setWeight(QmlFontValueType::FontWeight w)
+{
+ font.setWeight((QFont::Weight)w);
+}
+
bool QmlFontValueType::italic() const
{
return font.italic();
@@ -541,6 +551,26 @@ void QmlFontValueType::setUnderline(bool b)
font.setUnderline(b);
}
+bool QmlFontValueType::overline() const
+{
+ return font.overline();
+}
+
+void QmlFontValueType::setOverline(bool b)
+{
+ font.setOverline(b);
+}
+
+bool QmlFontValueType::strikeout() const
+{
+ return font.strikeOut();
+}
+
+void QmlFontValueType::setStrikeout(bool b)
+{
+ font.setStrikeOut(b);
+}
+
qreal QmlFontValueType::pointSize() const
{
return font.pointSizeF();
@@ -566,4 +596,34 @@ void QmlFontValueType::setPixelSize(int size)
hasPixelSize = true;
}
+QmlFontValueType::Capitalization QmlFontValueType::capitalization() const
+{
+ return (QmlFontValueType::Capitalization)font.capitalization();
+}
+
+void QmlFontValueType::setCapitalization(QmlFontValueType::Capitalization c)
+{
+ font.setCapitalization((QFont::Capitalization)c);
+}
+
+qreal QmlFontValueType::letterSpacing() const
+{
+ return font.letterSpacing();
+}
+
+void QmlFontValueType::setLetterSpacing(qreal size)
+{
+ font.setLetterSpacing(QFont::PercentageSpacing, size);
+}
+
+qreal QmlFontValueType::wordSpacing() const
+{
+ return font.wordSpacing();
+}
+
+void QmlFontValueType::setWordSpacing(qreal size)
+{
+ font.setWordSpacing(size);
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlvaluetype_p.h b/src/declarative/qml/qmlvaluetype_p.h
index 9842c02..0af3813 100644
--- a/src/declarative/qml/qmlvaluetype_p.h
+++ b/src/declarative/qml/qmlvaluetype_p.h
@@ -258,13 +258,34 @@ private:
class QmlFontValueType : public QmlValueType
{
Q_OBJECT
+ Q_ENUMS(FontWeight)
+ Q_ENUMS(Capitalization)
+
Q_PROPERTY(QString family READ family WRITE setFamily)
Q_PROPERTY(bool bold READ bold WRITE setBold)
+ Q_PROPERTY(FontWeight weight READ weight WRITE setWeight)
Q_PROPERTY(bool italic READ italic WRITE setItalic)
Q_PROPERTY(bool underline READ underline WRITE setUnderline)
+ Q_PROPERTY(bool overline READ overline WRITE setOverline)
+ Q_PROPERTY(bool strikeout READ strikeout WRITE setStrikeout)
Q_PROPERTY(qreal pointSize READ pointSize WRITE setPointSize)
Q_PROPERTY(int pixelSize READ pixelSize WRITE setPixelSize)
+ Q_PROPERTY(Capitalization capitalization READ capitalization WRITE setCapitalization)
+ Q_PROPERTY(qreal letterSpacing READ letterSpacing WRITE setLetterSpacing)
+ Q_PROPERTY(qreal wordSpacing READ wordSpacing WRITE setWordSpacing)
+
public:
+ enum FontWeight { Light = QFont::Light,
+ Normal = QFont::Normal,
+ DemiBold = QFont::DemiBold,
+ Bold = QFont::Bold,
+ Black = QFont::Black };
+ enum Capitalization { MixedCase = QFont::MixedCase,
+ AllUppercase = QFont::AllUppercase,
+ AllLowercase = QFont::AllLowercase,
+ SmallCaps = QFont::SmallCaps,
+ Capitalize = QFont::Capitalize };
+
QmlFontValueType(QObject *parent = 0);
virtual void read(QObject *, int);
@@ -278,18 +299,36 @@ public:
bool bold() const;
void setBold(bool b);
+ FontWeight weight() const;
+ void setWeight(FontWeight);
+
bool italic() const;
void setItalic(bool b);
bool underline() const;
void setUnderline(bool b);
+ bool overline() const;
+ void setOverline(bool b);
+
+ bool strikeout() const;
+ void setStrikeout(bool b);
+
qreal pointSize() const;
void setPointSize(qreal size);
int pixelSize() const;
void setPixelSize(int size);
+ Capitalization capitalization() const;
+ void setCapitalization(Capitalization);
+
+ qreal letterSpacing() const;
+ void setLetterSpacing(qreal spacing);
+
+ qreal wordSpacing() const;
+ void setWordSpacing(qreal spacing);
+
private:
QFont font;
bool hasPixelSize;
diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp
index f518ea5..2eb9dca 100644
--- a/src/declarative/util/qmlstategroup.cpp
+++ b/src/declarative/util/qmlstategroup.cpp
@@ -84,6 +84,34 @@ public:
void updateAutoState();
};
+/*!
+ \qmlclass StateGroup QmlStateGroup
+ \brief The StateGroup element provides state support for non-Item elements.
+
+ Item (and all dervied elements) provides built in support for states and transitions
+ via its state, states and transitions properties. StateGroup provides an easy way to
+ use this support in other (non-Item-derived) elements.
+
+ \qml
+ MyCustomObject {
+ StateGroup {
+ id: myStateGroup
+ states: State {
+ name: "state1"
+ ...
+ }
+ transitions: Transition {
+ ...
+ }
+ }
+
+ onSomethingHappened: myStateGroup.state = "state1";
+ }
+ \endqml
+
+ \sa {qmlstate}{States} and {state-transitions}{Transitions}
+*/
+
QmlStateGroup::QmlStateGroup(QObject *parent)
: QObject(*(new QmlStateGroupPrivate(this)), parent)
{
@@ -99,18 +127,75 @@ QList<QmlState *> QmlStateGroup::states() const
return d->states;
}
+/*!
+ \qmlproperty list<State> StateGroup::states
+ This property holds a list of states defined by the state group.
+
+ \qml
+ StateGroup {
+ states: [
+ State { ... },
+ State { ... }
+ ...
+ ]
+ }
+ \endqml
+
+ \sa {qmlstate}{States}
+*/
QmlList<QmlState *>* QmlStateGroup::statesProperty()
{
Q_D(QmlStateGroup);
return &(d->states);
}
+/*!
+ \qmlproperty list<Transition> StateGroup::transitions
+ This property holds a list of transitions defined by the state group.
+
+ \qml
+ StateGroup {
+ transitions: [
+ Transition { ... },
+ Transition { ... }
+ ...
+ ]
+ }
+ \endqml
+
+ \sa {state-transitions}{Transitions}
+*/
QmlList<QmlTransition *>* QmlStateGroup::transitionsProperty()
{
Q_D(QmlStateGroup);
return &(d->transitions);
}
+/*!
+ \qmlproperty string StateGroup::state
+
+ This property holds the name of the current state of the state group.
+
+ This property is often used in scripts to change between states. For
+ example:
+
+ \qml
+ Script {
+ function toggle() {
+ if (button.state == 'On')
+ button.state = 'Off';
+ else
+ button.state = 'On';
+ }
+ }
+ \endqml
+
+ If the state group is in its base state (i.e. no explicit state has been
+ set), \c state will be a blank string. Likewise, you can return a
+ state group to its base state by setting its current state to \c ''.
+
+ \sa {qmlstates}{States}
+*/
QString QmlStateGroup::state() const
{
Q_D(const QmlStateGroup);
diff --git a/src/declarative/util/qmltimer.cpp b/src/declarative/util/qmltimer.cpp
index 268d5ec..2e844be 100644
--- a/src/declarative/util/qmltimer.cpp
+++ b/src/declarative/util/qmltimer.cpp
@@ -57,12 +57,12 @@ public:
: interval(1000), running(false), repeating(false), triggeredOnStart(false)
, classBegun(false), componentComplete(false) {}
int interval;
- bool running;
- bool repeating;
- bool triggeredOnStart;
QPauseAnimation pause;
- bool classBegun;
- bool componentComplete;
+ bool running : 1;
+ bool repeating : 1;
+ bool triggeredOnStart : 1;
+ bool classBegun : 1;
+ bool componentComplete : 1;
};
/*!
@@ -82,6 +82,9 @@ public:
}
\endqml
+ QmlTimer is synchronized with the animation timer. Since the animation
+ timer is usually set to 60fps, the resolution of QmlTimer will be
+ at best 16ms.
*/
QmlTimer::QmlTimer(QObject *parent)
@@ -89,7 +92,6 @@ QmlTimer::QmlTimer(QObject *parent)
{
Q_D(QmlTimer);
connect(&d->pause, SIGNAL(currentLoopChanged(int)), this, SLOT(ticked()));
- connect(&d->pause, SIGNAL(finished()), this, SLOT(ticked()));
connect(&d->pause, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))
, this, SLOT(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
d->pause.setLoopCount(1);
@@ -259,7 +261,9 @@ void QmlTimer::componentComplete()
*/
void QmlTimer::ticked()
{
- emit triggered();
+ Q_D(QmlTimer);
+ if (d->running)
+ emit triggered();
}
void QmlTimer::stateChanged(QAbstractAnimation::State, QAbstractAnimation::State state)
@@ -267,6 +271,7 @@ void QmlTimer::stateChanged(QAbstractAnimation::State, QAbstractAnimation::State
Q_D(QmlTimer);
if (d->running && state != QAbstractAnimation::Running) {
d->running = false;
+ emit triggered();
emit runningChanged();
}
}