diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-03-31 06:45:31 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-03-31 06:45:31 (GMT) |
commit | b6a0595e6479138b9d58c499f4285b357e81b2eb (patch) | |
tree | 2e10e8a59ae55f75e44b67a310103a084e8d169f /src/declarative | |
parent | e178cf86ff5007d5af31181d064b1bf824ffbc33 (diff) | |
parent | a795a55cf2796a44cf30e002962ebad0588ef740 (diff) | |
download | Qt-b6a0595e6479138b9d58c499f4285b357e81b2eb.zip Qt-b6a0595e6479138b9d58c499f4285b357e81b2eb.tar.gz Qt-b6a0595e6479138b9d58c499f4285b357e81b2eb.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/QmlChanges.txt | 33 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeflipable.cpp | 2 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeimage.cpp | 4 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeitem.cpp | 16 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp | 2 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativemousearea.cpp | 1 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 11 |
7 files changed, 60 insertions, 9 deletions
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 847f1f5..c86bdc6 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -32,6 +32,39 @@ syntax has been introduced: Item { Behavior on x {}; NumberAnimation on y {} } Only the syntax has changed, the behavior is identical. + +EaseFollow changed to SmoothedAnimation +--------------------------------------- +EaseFollow was renamed to SmoothedAnimation and now it inherits from +NumberAnimaton and as a consequence SmoothedAnimation can be used inside +Behaviors, as PropertySourceValues or in state transitions, like any other animation. + +The old EaseFollow properties changed to comply with the other declarative +animations ('source' changed to 'to'), so now 'to' changes are not +automatically 'followed' anymore. + +If you want to follow an hypothetical rect1, you should do now: + + Rectangle { + color: "green" + width: 60; height: 60; + x: rect1.x - 5; y: rect1.y - 5; + Behavior on x { SmoothedAnimation { velocity: 200 } } + Behavior on y { SmoothedAnimation { velocity: 200 } } + } + +instead of the old automatic source changed tracking: + + Rectangle { + color: "green" + width: 60; height: 60; + EaseFollow on x { source: rect1.x - 5; velocity: 200 } + EaseFollow on y { source: rect1.y - 5; velocity: 200 } + } + +This is a syntax and behavior change. + + Script element removed ---------------------- Inline Script{} blocks have been deprecated, and will soon be removed entirely. diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index e670d3e..ccefc70 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -75,7 +75,7 @@ public: Here is a Flipable that flips whenever it is clicked: - \snippet examples/declarative/flipable/flipable-example.qml 0 + \snippet doc/src/snippets/declarative/flipable.qml 0 \image flipable.gif diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 23a2350..3145c43 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -275,6 +275,10 @@ qreal QDeclarativeImage::paintedHeight() const used by a loaded image. The image will be scaled down if its intrinsic size is greater than this value. + If only one dimension of the size is set (and the other left at 0), the + unset dimension will be set in proportion to the set dimension to preserve + the source image aspect ratio. The fillMode is independent of this. + Unlike setting the width and height properties, which merely scale the painting of the image, this property affects the number of pixels stored. diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 29490e3..05e13a7 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1510,11 +1510,19 @@ QDeclarativeAnchors *QDeclarativeItem::anchors() void QDeclarativeItemPrivate::data_append(QDeclarativeListProperty<QObject> *prop, QObject *o) { - QGraphicsObject *i = qobject_cast<QGraphicsObject *>(o); - if (i) { - i->setParentItem(static_cast<QDeclarativeItem *>(prop->object)); + if (!o) + return; + + QDeclarativeItem *that = static_cast<QDeclarativeItem *>(prop->object); + + // This test is measurably (albeit only slightly) faster than qobject_cast<>() + const QMetaObject *mo = o->metaObject(); + while (mo && mo != &QGraphicsObject::staticMetaObject) mo = mo->d.superdata; + + if (mo) { + QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(o))->setParentItemHelper(that, 0, 0); } else { - o->setParent(static_cast<QDeclarativeItem *>(prop->object)); + o->setParent(that); } } diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 7bc74ce..97a22cf 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -130,7 +130,6 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType<QDeclarativeTextEdit>("Qt",4,6,"TextEdit"); qmlRegisterType<QDeclarativeTextInput>("Qt",4,6,"TextInput"); qmlRegisterType<QDeclarativeViewSection>("Qt",4,6,"ViewSection"); - qmlRegisterType<QDeclarativeFlickableVisibleArea>("Qt",4,6,"VisibleArea"); qmlRegisterType<QDeclarativeVisualDataModel>("Qt",4,6,"VisualDataModel"); qmlRegisterType<QDeclarativeVisualItemModel>("Qt",4,6,"VisualItemModel"); @@ -148,6 +147,7 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType<QDeclarativeVisualModel>(); qmlRegisterType<QAction>(); qmlRegisterType<QDeclarativePen>(); + qmlRegisterType<QDeclarativeFlickableVisibleArea>(); #ifdef QT_WEBKIT_LIB qmlRegisterType<QDeclarativeWebSettings>(); #endif diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index dde3366..6126a6f 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -640,6 +640,7 @@ bool QDeclarativeMouseArea::setPressed(bool p) QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, isclick, d->longPress); if (d->pressed) { emit pressed(&me); + emit positionChanged(&me); } else { emit released(&me); if (isclick) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index abac086..bb742ee 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1463,13 +1463,14 @@ public: QDeclarativeDirComponents importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine) { QFile file(absoluteFilePath); - QString dir = QFileInfo(file).path(); QString filecontent; if (file.open(QFile::ReadOnly)) { filecontent = QString::fromUtf8(file.readAll()); if (qmlImportTrace()) qDebug() << "QDeclarativeEngine::add: loaded" << absoluteFilePath; } + QDir dir = QFileInfo(file).dir(); + QDeclarativeDirParser qmldirParser; qmldirParser.setSource(filecontent); qmldirParser.parse(); @@ -1479,9 +1480,13 @@ public: foreach (const QDeclarativeDirParser::Plugin &plugin, qmldirParser.plugins()) { - QDir pluginDir(dir + QDir::separator() + plugin.path); - if (dir.startsWith(QLatin1Char(':'))) + + QDir pluginDir = dir.absoluteFilePath(plugin.path); + + // hack for resources, should probably go away + if (absoluteFilePath.startsWith(QLatin1Char(':'))) pluginDir = QDir(QCoreApplication::applicationDirPath()); + QString resolvedFilePath = QDeclarativeEnginePrivate::get(engine) ->resolvePlugin(pluginDir, |