From 155065cd5c611e2d14357a8ff3180ac14a68e3a0 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 2 Nov 2010 10:41:25 +1000 Subject: Removing a binding while it is being applied caused a crash. Use a weak pointer to the binding in case applying the binding (while fast forwarding) causes it to be removed. Task-number: QTBUG-14830 Reviewed-by: Michael Brasser --- src/declarative/util/qdeclarativestate.cpp | 12 ++++----- src/declarative/util/qdeclarativestate_p.h | 3 ++- src/declarative/util/qdeclarativestate_p_p.h | 2 +- .../util/qdeclarativetransitionmanager.cpp | 16 ++++++------ .../qdeclarativestates/data/QTBUG-14830.qml | 29 ++++++++++++++++++++++ .../qdeclarativestates/tst_qdeclarativestates.cpp | 13 ++++++++++ 6 files changed, 59 insertions(+), 16 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativestates/data/QTBUG-14830.qml diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index 0f5413e..3915485 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG); QDeclarativeAction::QDeclarativeAction() -: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(0), toBinding(0), event(0), +: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(0), event(0), specifiedObject(0) { } @@ -67,7 +67,7 @@ QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyN const QVariant &value) : restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), property(target, propertyName), toValue(value), - fromBinding(0), toBinding(0), event(0), + fromBinding(0), event(0), specifiedObject(target), specifiedProperty(propertyName) { if (property.isValid()) @@ -78,7 +78,7 @@ QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyN QDeclarativeContext *context, const QVariant &value) : restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), property(target, propertyName, context), toValue(value), - fromBinding(0), toBinding(0), event(0), + fromBinding(0), event(0), specifiedObject(target), specifiedProperty(propertyName) { if (property.isValid()) @@ -503,11 +503,11 @@ void QDeclarativeState::addEntriesToRevertList(const QList & const QDeclarativeAction &action = actionListIterator.next(); QDeclarativeSimpleAction simpleAction(action); action.property.write(action.toValue); - if (action.toBinding) { + if (!action.toBinding.isNull()) { QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::binding(simpleAction.property()); if (oldBinding) QDeclarativePropertyPrivate::setBinding(simpleAction.property(), 0); - QDeclarativePropertyPrivate::setBinding(simpleAction.property(), action.toBinding, QDeclarativePropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::setBinding(simpleAction.property(), action.toBinding.data(), QDeclarativePropertyPrivate::DontRemoveBinding); } simpleActionList.append(simpleAction); @@ -675,7 +675,7 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit a.property = d->revertList.at(ii).property(); a.fromValue = cur; a.toValue = d->revertList.at(ii).value(); - a.toBinding = d->revertList.at(ii).binding(); + a.toBinding = QDeclarativeAbstractBinding::getPointer(d->revertList.at(ii).binding()); a.specifiedObject = d->revertList.at(ii).specifiedObject(); a.specifiedProperty = d->revertList.at(ii).specifiedProperty(); a.event = d->revertList.at(ii).event(); diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h index fc7c940..7b9c18a 100644 --- a/src/declarative/util/qdeclarativestate_p.h +++ b/src/declarative/util/qdeclarativestate_p.h @@ -45,6 +45,7 @@ #include #include #include +#include #include QT_BEGIN_HEADER @@ -75,7 +76,7 @@ public: QVariant toValue; QDeclarativeAbstractBinding *fromBinding; - QDeclarativeAbstractBinding *toBinding; + QDeclarativeAbstractBinding::Pointer toBinding; QDeclarativeActionEvent *event; //strictly for matching diff --git a/src/declarative/util/qdeclarativestate_p_p.h b/src/declarative/util/qdeclarativestate_p_p.h index 4fd8f21..98c3f7b 100644 --- a/src/declarative/util/qdeclarativestate_p_p.h +++ b/src/declarative/util/qdeclarativestate_p_p.h @@ -85,7 +85,7 @@ public: m_reverseEvent = true; } else { m_value = a.toValue; - m_binding = QDeclarativeAbstractBinding::getPointer(a.toBinding); + m_binding = a.toBinding; m_reverseEvent = false; } } diff --git a/src/declarative/util/qdeclarativetransitionmanager.cpp b/src/declarative/util/qdeclarativetransitionmanager.cpp index 89b0044..d19e6f2 100644 --- a/src/declarative/util/qdeclarativetransitionmanager.cpp +++ b/src/declarative/util/qdeclarativetransitionmanager.cpp @@ -99,8 +99,8 @@ void QDeclarativeTransitionManager::complete() void QDeclarativeTransitionManagerPrivate::applyBindings() { foreach(const QDeclarativeAction &action, bindingsList) { - if (action.toBinding) { - QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding); + if (!action.toBinding.isNull()) { + QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding.data()); } else if (action.event) { if (action.reverseEvent) action.event->reverse(); @@ -145,8 +145,8 @@ void QDeclarativeTransitionManager::transition(const QList & // Apply all the property and binding changes for (int ii = 0; ii < applyList.size(); ++ii) { const QDeclarativeAction &action = applyList.at(ii); - if (action.toBinding) { - QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); + if (!action.toBinding.isNull()) { + QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding.data(), QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } else if (!action.event) { QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } else if (action.event->isReversable()) { @@ -165,7 +165,7 @@ void QDeclarativeTransitionManager::transition(const QList & continue; } const QDeclarativeProperty &prop = action->property; - if (action->toBinding || !action->toValue.isValid()) { + if (!action->toBinding.isNull() || !action->toValue.isValid()) { action->toValue = prop.read(); } } @@ -259,10 +259,10 @@ void QDeclarativeTransitionManager::cancel() for(int i = 0; i < d->bindingsList.count(); ++i) { QDeclarativeAction action = d->bindingsList[i]; - if (action.toBinding && action.deletableToBinding) { + if (!action.toBinding.isNull() && action.deletableToBinding) { QDeclarativePropertyPrivate::setBinding(action.property, 0); - action.toBinding->destroy(); - action.toBinding = 0; + action.toBinding.data()->destroy(); + action.toBinding.clear(); action.deletableToBinding = false; } else if (action.event) { //### what do we do here? diff --git a/tests/auto/declarative/qdeclarativestates/data/QTBUG-14830.qml b/tests/auto/declarative/qdeclarativestates/data/QTBUG-14830.qml new file mode 100644 index 0000000..5eccdda --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/QTBUG-14830.qml @@ -0,0 +1,29 @@ +import Qt 4.7 + +Rectangle { + width: 1024 + height: 768 + + Item { + id: area + objectName: "area" + property int numx: 6 + property int cellwidth: 1024/numx + + onWidthChanged: { + width = width>1024?1024:width; + } + + state: 'minimal' + states: [ + State { + name: 'minimal' + PropertyChanges { + target: area + width: cellwidth + } + } + ] + + } +} diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index 0d10c10..b8409a5 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -143,6 +143,7 @@ private slots: void returnToBase(); void extendsBug(); void editProperties(); + void QTBUG_14830(); }; void tst_qdeclarativestates::initTestCase() @@ -1375,6 +1376,18 @@ void tst_qdeclarativestates::editProperties() QCOMPARE(childRect->height(), qreal(40)); } +void tst_qdeclarativestates::QTBUG_14830() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/QTBUG-14830.qml"); + QDeclarativeRectangle *rect = qobject_cast(c.create()); + QVERIFY(rect != 0); + QDeclarativeItem *item = rect->findChild("area"); + + QCOMPARE(item->width(), qreal(171)); +} + QTEST_MAIN(tst_qdeclarativestates) #include "tst_qdeclarativestates.moc" -- cgit v0.12 From 11bb4f85ef38270758ec0930709c23c7fcb5840c Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 2 Nov 2010 16:41:01 +1000 Subject: Regression: Text element breaks when using \n for separating lines Task-number: QTBUG-14915 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativetext.cpp | 24 ++-- .../qdeclarativetext/font/data-MAC/plaintext2.qml | 131 +++++++++++++++++++++ .../qmlvisual/qdeclarativetext/font/plaintext2.qml | 22 ++++ 3 files changed, 165 insertions(+), 12 deletions(-) create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-MAC/plaintext2.qml create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext2.qml diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 03c9765..8cb47aa 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -291,30 +291,30 @@ QSize QDeclarativeTextPrivate::setupTextLayout() qreal height = 0; qreal lineWidth = 0; - //set manual width - if (q->widthValid()) - lineWidth = q->width(); - QTextOption textOption = layout.textOption(); - textOption.setWrapMode(QTextOption::WrapMode(wrapMode)); + textOption.setWrapMode(QTextOption::NoWrap); textOption.setAlignment(Qt::Alignment(hAlign)); - layout.setTextOption(textOption); + // if the item has an explicit width, we set the line width and enable wrapping + if (q->widthValid()) { + lineWidth = q->width(); + textOption.setWrapMode(QTextOption::WrapMode(wrapMode)); + } + + layout.setTextOption(textOption); layout.beginLayout(); while (1) { QTextLine line = layout.createLine(); if (!line.isValid()) break; - if (q->widthValid()) { - line.setLineWidth(lineWidth); - line.setPosition(QPointF(0, height)); - height += line.height(); - } + line.setLineWidth(lineWidth); + line.setPosition(QPointF(0, height)); + height += line.height(); } layout.endLayout(); - return QSize(qCeil(layout.boundingRect().width()), layout.boundingRect().height()); + return layout.boundingRect().toAlignedRect().size(); } /*! diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-MAC/plaintext2.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-MAC/plaintext2.qml new file mode 100644 index 0000000..1a8af0e --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-MAC/plaintext2.qml @@ -0,0 +1,131 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 32 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 48 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 64 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 80 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 96 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 112 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 128 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 144 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 160 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 176 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 192 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 208 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 224 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 240 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 256 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 272 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 288 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 304 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 320 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 336 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 352 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 368 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 384 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 400 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 416 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 432 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Key { + type: 6 + key: 16777249 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 448 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } + Frame { + msec: 464 + hash: "c68e50ef84647962481121e2eb1ba4d4" + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext2.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext2.qml new file mode 100644 index 0000000..901025a --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext2.qml @@ -0,0 +1,22 @@ +import QtQuick 1.0 + +Rectangle { + width: 400; height: 200 + + Row { + spacing: 20 + anchors.centerIn: parent + Text { + text: "First line\nSecond line"; wrapMode: Text.Wrap + } + Text { + text: "First line\nSecond line"; width: 70 + } + Text { + text: "First Second\nThird Fourth"; wrapMode: Text.Wrap; width: 50 + } + Text { + text: "First line
Second line"; textFormat: Text.StyledText + } + } +} -- cgit v0.12 From b2016bbfc9c7389e7b64451417395ceba96af21f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 2 Nov 2010 13:07:01 +0100 Subject: Qml Debugging: Only enable if explicitly requested Enable the remote debugging of QDeclarativeEngines only after QDeclarativeDebugHelper::enableDebugging() has been called. Approved by 4.7 Program Team. Reviewed-by: Alessandro Portale Task-number: QTBUG-13762 --- src/declarative/debugger/qdeclarativedebughelper.cpp | 8 ++++++++ src/declarative/debugger/qdeclarativedebughelper_p.h | 4 ++++ src/declarative/debugger/qdeclarativedebugservice.cpp | 7 +++++++ src/declarative/qml/qdeclarativeengine.cpp | 1 + src/declarative/qml/qdeclarativeengine_p.h | 2 ++ src/s60installs/bwins/QtDeclarativeu.def | 3 ++- src/s60installs/eabi/QtDeclarativeu.def | 3 ++- .../auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp | 5 ++++- .../qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp | 5 ++++- .../private_headers/qdeclarativedebughelper_p.h | 4 ++++ .../qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp | 7 +++++++ .../qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp | 4 ++++ 12 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebughelper.cpp b/src/declarative/debugger/qdeclarativedebughelper.cpp index 207ad2b..b003c12 100644 --- a/src/declarative/debugger/qdeclarativedebughelper.cpp +++ b/src/declarative/debugger/qdeclarativedebughelper.cpp @@ -48,6 +48,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -63,4 +64,11 @@ void QDeclarativeDebugHelper::setAnimationSlowDownFactor(qreal factor) timer->setSlowdownFactor(factor); } +void QDeclarativeDebugHelper::enableDebugging() { + if (!QDeclarativeEnginePrivate::qml_debugging_enabled) { + qWarning("Qml debugging is enabled. Only use this in a safe environment!"); + } + QDeclarativeEnginePrivate::qml_debugging_enabled = true; +} + QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebughelper_p.h b/src/declarative/debugger/qdeclarativedebughelper_p.h index 5689dff..a1ac23d 100644 --- a/src/declarative/debugger/qdeclarativedebughelper_p.h +++ b/src/declarative/debugger/qdeclarativedebughelper_p.h @@ -60,6 +60,10 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugHelper public: static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); static void setAnimationSlowDownFactor(qreal factor); + + // Enables remote debugging functionality + // Only use this for debugging in a safe environment! + static void enableDebugging(); }; QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp index c39da3d..8c86ae8 100644 --- a/src/declarative/debugger/qdeclarativedebugservice.cpp +++ b/src/declarative/debugger/qdeclarativedebugservice.cpp @@ -42,6 +42,7 @@ #include "private/qdeclarativedebugservice_p.h" #include "private/qpacketprotocol_p.h" +#include "private/qdeclarativeengine_p.h" #include #include @@ -205,6 +206,12 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance() // format: qmljsdebugger=port:3768[,block] if (!appD->qmljsDebugArgumentsString().isEmpty()) { + if (!QDeclarativeEnginePrivate::qml_debugging_enabled) { + qWarning() << QString::fromLatin1("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". " + "Debugging has not been enabled.").arg( + appD->qmljsDebugArgumentsString()).toAscii().constData(); + return 0; + } if (appD->qmljsDebugArgumentsString().indexOf(QLatin1String("port:")) == 0) { int separatorIndex = appD->qmljsDebugArgumentsString().indexOf(QLatin1Char(',')); diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 6906f21..808ba68 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -176,6 +176,7 @@ struct StaticQtMetaObject : public QObject }; static bool qt_QmlQtModule_registered = false; +bool QDeclarativeEnginePrivate::qml_debugging_enabled = false; void QDeclarativeEnginePrivate::defineModule() { diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 8539fbf..deb4a77 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -321,6 +321,8 @@ public: static QString urlToLocalFileOrQrc(const QUrl& url); static void defineModule(); + + static bool qml_debugging_enabled; }; /*! diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index db4012c..9e88df7 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -1838,5 +1838,6 @@ EXPORTS ?addChanged@QDeclarativeBasePositioner@@IAEXXZ @ 1837 NONAME ABSENT ; void QDeclarativeBasePositioner::addChanged(void) ?start@QDeclarativeAbstractAnimation@@QAEXXZ @ 1838 NONAME ABSENT ; void QDeclarativeAbstractAnimation::start(void) ?qt_metacall@QDeclarativeAbstractAnimation@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1839 NONAME ABSENT ; int QDeclarativeAbstractAnimation::qt_metacall(enum QMetaObject::Call, int, void * *) - ?connect@QDeclarativePropertyPrivate@@SA_NPBVQObject@@H0HHPAH@Z @ 1840 NONAME ABSENT ; bool QDeclarativePropertyPrivate::connect(class QObject const *, int, class QObject const *, int, int, int *) + ?enableDebugging@QDeclarativeDebugHelper@@SAXXZ @ 1840 NONAME ; void QDeclarativeDebugHelper::enableDebugging(void) + ?connect@QDeclarativePropertyPrivate@@SA_NPBVQObject@@H0HHPAH@Z @ 1841 NONAME ABSENT ; bool QDeclarativePropertyPrivate::connect(class QObject const *, int, class QObject const *, int, int, int *) diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def index 849ca6a..1f69061 100644 --- a/src/s60installs/eabi/QtDeclarativeu.def +++ b/src/s60installs/eabi/QtDeclarativeu.def @@ -1883,5 +1883,6 @@ EXPORTS _ZThn8_N29QDeclarativeAbstractAnimation9setTargetERK20QDeclarativeProperty @ 1882 NONAME ABSENT _ZThn8_N29QDeclarativeAbstractAnimationD0Ev @ 1883 NONAME ABSENT _ZThn8_N29QDeclarativeAbstractAnimationD1Ev @ 1884 NONAME ABSENT - _ZN27QDeclarativePropertyPrivate7connectEPK7QObjectiS2_iiPi @ 1885 NONAME ABSENT + _ZN23QDeclarativeDebugHelper15enableDebuggingEv @ 1885 NONAME + _ZN27QDeclarativePropertyPrivate7connectEPK7QObjectiS2_iiPi @ 1886 NONAME ABSENT diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index e6a81b8..53471bf 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -59,6 +59,7 @@ #include #include #include +#include #include "../../../shared/util.h" #include "../shared/debugutil_p.h" @@ -278,8 +279,10 @@ void tst_QDeclarativeDebug::initTestCase() { qRegisterMetaType(); - QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 3768..."); + QTest::ignoreMessage(QtWarningMsg, "Qml debugging is enabled. Only use this in a safe environment!"); + QDeclarativeDebugHelper::enableDebugging(); + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 3768..."); m_engine = new QDeclarativeEngine(this); QList qml; diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp index 80241ba..64afd4e 100644 --- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp +++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include "../../../shared/util.h" #include "../shared/debugutil_p.h" @@ -72,8 +73,10 @@ private slots: void tst_QDeclarativeDebugClient::initTestCase() { - QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 3770..."); + QTest::ignoreMessage(QtWarningMsg, "Qml debugging is enabled. Only use this in a safe environment!"); + QDeclarativeDebugHelper::enableDebugging(); + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 3770..."); new QDeclarativeEngine(this); m_conn = new QDeclarativeDebugConnection(this); diff --git a/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h index c9cb839..edfc58f 100644 --- a/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h +++ b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h @@ -58,6 +58,10 @@ class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper public: static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); static void setAnimationSlowDownFactor(qreal factor); + + // Enables remote debugging functionality + // Only use this for debugging in a safe environment! + static void enableDebugging(); }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp b/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp index 36f2222..60aec9d 100644 --- a/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp +++ b/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp @@ -54,6 +54,7 @@ class tst_qdeclarativedebughelper : public QObject { private slots: void getScriptEngine(); void setAnimationSlowDownFactor(); + void enableDebugging(); }; class TestAnimation : public QAbstractAnimation { @@ -109,6 +110,12 @@ void tst_qdeclarativedebughelper::setAnimationSlowDownFactor() QVERIFY(animation.updateCalled > 1); } +void tst_qdeclarativedebughelper::enableDebugging() +{ + QTest::ignoreMessage(QtWarningMsg, "Qml debugging is enabled. Only use this in a safe environment!"); + QDeclarativeDebugHelper::enableDebugging(); +} + QTEST_MAIN(tst_qdeclarativedebughelper) #include "tst_qdeclarativedebughelper.moc" diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp index 538129c..30629f9 100644 --- a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp +++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp @@ -46,6 +46,7 @@ #include #include +#include #include #include @@ -75,6 +76,9 @@ private slots: void tst_QDeclarativeDebugService::initTestCase() { + QTest::ignoreMessage(QtWarningMsg, "Qml debugging is enabled. Only use this in a safe environment!"); + QDeclarativeDebugHelper::enableDebugging(); + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 3769..."); new QDeclarativeEngine(this); -- cgit v0.12 From af15292e4982c11542487d39fc76ccfb8516598f Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 3 Nov 2010 14:55:46 +1000 Subject: Regression: QDeclarativeText does not update when text turns empty Task-number: QTBUG-14865 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativetext.cpp | 1 + .../graphicsitems/qdeclarativetextlayout.cpp | 13 + .../graphicsitems/qdeclarativetextlayout_p.h | 1 + .../qdeclarativetext/data-MAC/qtbug_14865.0.png | Bin 0 -> 1695 bytes .../qdeclarativetext/data-MAC/qtbug_14865.1.png | Bin 0 -> 625 bytes .../qdeclarativetext/data-MAC/qtbug_14865.qml | 719 +++++++++++++++++++++ .../qmlvisual/qdeclarativetext/qtbug_14865.qml | 17 + 7 files changed, 751 insertions(+) create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.0.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.1.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.qml create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/qtbug_14865.qml diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 8cb47aa..84f276e 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -219,6 +219,7 @@ void QDeclarativeTextPrivate::updateSize() QFontMetrics fm(font); if (text.isEmpty()) { + q->setImplicitWidth(0); q->setImplicitHeight(fm.height()); emit q->paintedSizeChanged(); q->update(); diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp index 89a2158..db5d75d 100644 --- a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp @@ -285,6 +285,19 @@ void QDeclarativeTextLayout::beginLayout() QTextLayout::beginLayout(); } +void QDeclarativeTextLayout::clearLayout() +{ + if (d && d->cached) { + d->cached = false; + d->items.clear(); + d->positions.clear(); + d->glyphs.clear(); + d->chars.clear(); + d->position = QPointF(); + } + QTextLayout::clearLayout(); +} + void QDeclarativeTextLayout::prepare() { if (!d || !d->cached) { diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h index 90bf0e0..8b81db3 100644 --- a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h @@ -59,6 +59,7 @@ public: ~QDeclarativeTextLayout(); void beginLayout(); + void clearLayout(); void prepare(); void draw(QPainter *, const QPointF & = QPointF()); diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.0.png new file mode 100644 index 0000000..a947584 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.0.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.1.png b/tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.1.png new file mode 100644 index 0000000..84430bb Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.1.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.qml new file mode 100644 index 0000000..940d3c1 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.qml @@ -0,0 +1,719 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 32 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 48 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 64 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 80 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 96 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 112 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 128 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 144 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 160 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 176 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 192 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 208 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 224 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 240 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 256 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 272 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 288 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 304 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 320 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 336 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 352 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 368 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 384 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 400 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 416 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 432 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 448 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 464 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 480 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 496 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 512 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 528 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 544 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 560 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 576 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 592 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 608 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 624 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 640 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 656 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 672 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 688 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 704 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 720 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 736 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 752 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 768 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 784 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 800 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 816 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 832 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 848 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 864 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 880 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 896 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 912 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 928 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 944 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 960 + image: "qtbug_14865.0.png" + } + Frame { + msec: 976 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 992 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 1008 + hash: "f5b2ec4a5220eabe1186bb2fd65a7263" + } + Frame { + msec: 1024 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1040 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1056 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1072 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1088 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1104 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1120 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1136 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1152 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1168 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1184 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1200 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1216 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1232 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1248 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1264 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1280 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1296 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1312 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1328 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1344 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1360 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1376 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1392 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1408 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1424 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1440 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1456 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1472 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1488 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1504 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1520 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1536 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1552 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1568 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1584 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1600 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1616 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1632 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1648 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1664 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1680 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1696 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1712 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1728 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1744 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1760 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1776 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1792 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1808 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1824 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1840 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1856 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1872 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1888 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1904 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1920 + image: "qtbug_14865.1.png" + } + Frame { + msec: 1936 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1952 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1968 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 1984 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2000 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2016 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2032 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2048 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2064 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2080 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2096 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2112 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2128 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2144 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2160 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2176 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2192 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2208 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2224 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2240 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2256 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Key { + type: 6 + key: 16777249 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 2272 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2288 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2304 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2320 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2336 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2352 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2368 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2384 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2400 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2416 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2432 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2448 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2464 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2480 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2496 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2512 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2528 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2544 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2560 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2576 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2592 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2608 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2624 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2640 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2656 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2672 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2688 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2704 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2720 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2736 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2752 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2768 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2784 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2800 + hash: "eee4600ac08b458ac7ac2320e225674c" + } + Frame { + msec: 2816 + hash: "eee4600ac08b458ac7ac2320e225674c" + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/qtbug_14865.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/qtbug_14865.qml new file mode 100644 index 0000000..07416dc --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/qtbug_14865.qml @@ -0,0 +1,17 @@ +import QtQuick 1.0 + +Rectangle { + width: 200; height: 200 + + Text { + id: label + objectName: "label" + text: "Hello world!" + width: 10 + } + + Timer { + running: true; interval: 1000 + onTriggered: label.text = "" + } +} -- cgit v0.12 From 648eb76c22762c510815305e9e495db2aee9d2ad Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 3 Nov 2010 16:18:11 +1000 Subject: Combining ListView.StrictlyEnforceRange and resizing currentItem stalls. There were two problems. 1) layout() called fixup() was called while the view was being flicked. 2) the snapping code was incorrect (and duplicated). Task-number: QTBUG-14821 Reviewed-by: Michael Brasser --- .../graphicsitems/qdeclarativeflickable.cpp | 9 +- .../graphicsitems/qdeclarativeflickable_p_p.h | 3 + .../graphicsitems/qdeclarativelistview.cpp | 62 +- .../qmlvisual/ListView/data/enforcerange.0.png | Bin 0 -> 680 bytes .../qmlvisual/ListView/data/enforcerange.1.png | Bin 0 -> 704 bytes .../qmlvisual/ListView/data/enforcerange.2.png | Bin 0 -> 695 bytes .../qmlvisual/ListView/data/enforcerange.3.png | Bin 0 -> 680 bytes .../qmlvisual/ListView/data/enforcerange.4.png | Bin 0 -> 701 bytes .../qmlvisual/ListView/data/enforcerange.5.png | Bin 0 -> 704 bytes .../qmlvisual/ListView/data/enforcerange.qml | 2119 ++++++++++++++++++++ .../qmlvisual/ListView/enforcerange.qml | 31 + 11 files changed, 2181 insertions(+), 43 deletions(-) create mode 100644 tests/auto/declarative/qmlvisual/ListView/data/enforcerange.0.png create mode 100644 tests/auto/declarative/qmlvisual/ListView/data/enforcerange.1.png create mode 100644 tests/auto/declarative/qmlvisual/ListView/data/enforcerange.2.png create mode 100644 tests/auto/declarative/qmlvisual/ListView/data/enforcerange.3.png create mode 100644 tests/auto/declarative/qmlvisual/ListView/data/enforcerange.4.png create mode 100644 tests/auto/declarative/qmlvisual/ListView/data/enforcerange.5.png create mode 100644 tests/auto/declarative/qmlvisual/ListView/data/enforcerange.qml create mode 100644 tests/auto/declarative/qmlvisual/ListView/enforcerange.qml diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index b737785..01a8585 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -53,9 +53,6 @@ QT_BEGIN_NAMESPACE // before we perform a flick. static const int FlickThreshold = 20; -// Really slow flicks can be annoying. -static const int MinimumFlickVelocity = 75; - QDeclarativeFlickableVisibleArea::QDeclarativeFlickableVisibleArea(QDeclarativeFlickable *parent) : QObject(parent), flickable(parent), m_xPosition(0.), m_widthRatio(0.) , m_yPosition(0.), m_heightRatio(0.) @@ -990,8 +987,8 @@ void QDeclarativeFlickable::viewportMoved() { Q_D(QDeclarativeFlickable); - qreal prevY = d->lastFlickablePosition.x(); - qreal prevX = d->lastFlickablePosition.y(); + qreal prevX = d->lastFlickablePosition.x(); + qreal prevY = d->lastFlickablePosition.y(); d->velocityTimeline.clear(); if (d->pressed || d->calcVelocity) { int elapsed = QDeclarativeItemPrivate::restart(d->velocityTime); @@ -1012,7 +1009,7 @@ void QDeclarativeFlickable::viewportMoved() } } - d->lastFlickablePosition = QPointF(d->vData.move.value(), d->hData.move.value()); + d->lastFlickablePosition = QPointF(d->hData.move.value(), d->vData.move.value()); d->vTime = d->timeline.time(); d->updateBeginningEnd(); diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h index afefde2..92cf748 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h @@ -66,6 +66,9 @@ QT_BEGIN_NAMESPACE +// Really slow flicks can be annoying. +const qreal MinimumFlickVelocity = 75.0; + class QDeclarativeFlickableVisibleArea; class QDeclarativeFlickablePrivate : public QDeclarativeItemPrivate, public QDeclarativeItemChangeListener { diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 38a4839..eab66d8 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -334,28 +334,9 @@ public: return model && model->count() && model->isValid(); } - int snapIndex() { - int index = currentIndex; - for (int i = 0; i < visibleItems.count(); ++i) { - FxListItem *item = visibleItems[i]; - if (item->index == -1) - continue; - qreal itemTop = item->position(); - if (itemTop >= highlight->position()-item->size()/2 && itemTop < highlight->position()+item->size()/2) - return item->index; - } - return index; - } - qreal snapPosAt(qreal pos) { - for (int i = 0; i < visibleItems.count(); ++i) { - FxListItem *item = visibleItems[i]; - if (item->index == -1) - continue; - qreal itemTop = item->position(); - if (itemTop+item->size()/2 >= pos && itemTop <= pos) - return item->position(); - } + if (FxListItem *snapItem = snapItemAt(pos)) + return snapItem->position(); if (visibleItems.count()) { qreal firstPos = visibleItems.first()->position(); qreal endPos = visibleItems.last()->position(); @@ -368,17 +349,18 @@ public: } FxListItem *snapItemAt(qreal pos) { + FxListItem *snapItem = 0; for (int i = 0; i < visibleItems.count(); ++i) { FxListItem *item = visibleItems[i]; if (item->index == -1) continue; qreal itemTop = item->position(); - if (item->index == model->count()-1 || (itemTop+item->size()/2 >= pos)) + if (highlight && itemTop >= pos && item->endPosition() <= pos + highlight->size() - 1) return item; + if (itemTop+item->size()/2 >= pos && itemTop-item->size()/2 < pos) + snapItem = item; } - if (visibleItems.count() && visibleItems.first()->position() <= pos) - return visibleItems.first(); - return 0; + return snapItem; } int lastVisibleIndex() const { @@ -768,8 +750,10 @@ void QDeclarativeListViewPrivate::layout() minExtentDirty = true; maxExtentDirty = true; updateHighlight(); - fixupPosition(); - q->refill(); + if (!q->isMoving() && !q->isFlicking()) { + fixupPosition(); + q->refill(); + } if (header) updateHeader(); if (footer) @@ -1350,12 +1334,15 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m qreal newtarget = data.flickTarget; if (snapMode != QDeclarativeListView::NoSnap || highlightRange == QDeclarativeListView::StrictlyEnforceRange) newtarget = -snapPosAt(-(data.flickTarget - highlightRangeStart)) + highlightRangeStart; - if (velocity < 0 && newtarget < maxExtent) - newtarget = maxExtent; - else if (velocity > 0 && newtarget > minExtent) - newtarget = minExtent; - if (newtarget == data.flickTarget) // boundary unchanged - nothing to do + if (velocity < 0 && newtarget <= maxExtent) + newtarget = maxExtent - overshootDist; + else if (velocity > 0 && newtarget >= minExtent) + newtarget = minExtent + overshootDist; + if (newtarget == data.flickTarget) { // boundary unchanged - nothing to do + if (qAbs(velocity) < MinimumFlickVelocity) + correctFlick = false; return; + } data.flickTarget = newtarget; qreal dist = -newtarget + data.move.value(); if ((v < 0 && dist < 0) || (v > 0 && dist > 0)) { @@ -1365,7 +1352,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m return; } timeline.reset(data.move); - timeline.accelDistance(data.move, v, -dist + (v < 0 ? -overshootDist : overshootDist)); + timeline.accelDistance(data.move, v, -dist); timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this)); } } else { @@ -1696,7 +1683,7 @@ void QDeclarativeListView::setCurrentIndex(int index) if (isComponentComplete() && d->isValid()) { d->moveReason = QDeclarativeListViewPrivate::SetIndex; d->updateCurrent(index); - } else { + } else if (d->currentIndex != index) { d->currentIndex = index; emit currentIndexChanged(); } @@ -2323,9 +2310,10 @@ void QDeclarativeListView::viewportMoved() d->highlight->setPosition(qRound(pos)); // update current index - int idx = d->snapIndex(); - if (idx >= 0 && idx != d->currentIndex) - d->updateCurrent(idx); + if (FxListItem *snapItem = d->snapItemAt(d->highlight->position())) { + if (snapItem->index >= 0 && snapItem->index != d->currentIndex) + d->updateCurrent(snapItem->index); + } } } diff --git a/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.0.png b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.0.png new file mode 100644 index 0000000..d466434 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.0.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.1.png b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.1.png new file mode 100644 index 0000000..45d9712 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.1.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.2.png b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.2.png new file mode 100644 index 0000000..3f05a5e Binary files /dev/null and b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.2.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.3.png b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.3.png new file mode 100644 index 0000000..d466434 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.3.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.4.png b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.4.png new file mode 100644 index 0000000..c902676 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.4.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.5.png b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.5.png new file mode 100644 index 0000000..45d9712 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.5.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.qml b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.qml new file mode 100644 index 0000000..c15b657 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.qml @@ -0,0 +1,2119 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 32 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 48 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 64 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 80 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 96 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 112 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 128 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 144 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 160 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 176 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 192 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 208 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 224 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 240 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 256 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 272 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 288 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 304 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 320 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 336 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 352 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 368 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 384 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 400 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 416 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 432 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 448 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 464 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 480 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 496 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 512 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 528 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 544 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 560 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 576 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 592 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 608 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 624 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 640 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 656 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 672 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 688 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 704 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 720 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 736 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 752 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 768 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 784 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 800 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 816 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 832 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 848 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 864 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 880 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 896 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 912 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 928 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 944 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 960 + image: "enforcerange.0.png" + } + Frame { + msec: 976 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 992 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 1008 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 1024 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 1040 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 1056 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 1072 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 1088 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 1104 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 1120 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 1136 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 1152 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 1168 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 1184 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 1200 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 77; y: 157 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1216 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 1232 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 1248 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 77; y: 156 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1264 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 77; y: 154 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 76; y: 151 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1280 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 75; y: 144 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 74; y: 136 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1296 + hash: "c7667b5af9f2ee912abe5879266cb1e0" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 73; y: 131 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 72; y: 122 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1312 + hash: "1e762d6ffe1ceb53046d7953645d02d5" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 71; y: 118 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 71; y: 111 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1328 + hash: "0d2b7130a84a8efac1cf4fe8a1768231" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 71; y: 108 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 71; y: 102 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1344 + hash: "6ef2715c3fd26d50d26fb740afa6dece" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 71; y: 98 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 71; y: 92 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 71; y: 92 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1360 + hash: "f489b6f951281ff9a981ec046ca5b17d" + } + Frame { + msec: 1376 + hash: "fd6e7d7db7c4571ee606269fb9680ed9" + } + Frame { + msec: 1392 + hash: "398a238f59a2edf07870b624b914c81d" + } + Frame { + msec: 1408 + hash: "fdce64faab7e7e31a229adda47924cd1" + } + Frame { + msec: 1424 + hash: "8d474956331fdd0c35beb13a06b7c557" + } + Frame { + msec: 1440 + hash: "f89fed6f7fa07a8320f07a1e68240a7e" + } + Frame { + msec: 1456 + hash: "940b70f15082ff138579892bb6f20ce9" + } + Frame { + msec: 1472 + hash: "35ab744ce2a91567dbbd769f9486f870" + } + Frame { + msec: 1488 + hash: "6b2d32b8f1df871c2c014af8b5d87329" + } + Frame { + msec: 1504 + hash: "edf3b33b80cca53999779555f9cd6162" + } + Frame { + msec: 1520 + hash: "180f3cc4ea5ff5b6f9e8be0294732d4e" + } + Frame { + msec: 1536 + hash: "28e9ca60a873910380b2d22d6b3df565" + } + Frame { + msec: 1552 + hash: "3bb1e8d69f171f09eb4c6f9914fc9576" + } + Frame { + msec: 1568 + hash: "0501da09be444df6cee4b19617290317" + } + Frame { + msec: 1584 + hash: "8ce1ac0163b0353167488aff2879e841" + } + Frame { + msec: 1600 + hash: "18e53bf6337cf6590fc3c73c00469d8e" + } + Frame { + msec: 1616 + hash: "0c31ede980d07069f4977d5753d00ddf" + } + Frame { + msec: 1632 + hash: "0a854a54176c24f0ebbb6cb747dc0ab7" + } + Frame { + msec: 1648 + hash: "8dba1ebca6f00b7a64a6982fb8c28c50" + } + Frame { + msec: 1664 + hash: "8d273efc36ba722af4d044e6552c9dcb" + } + Frame { + msec: 1680 + hash: "674b07dc5b99bf2da93c40d42dc9023d" + } + Frame { + msec: 1696 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 1712 + hash: "b64810845a97bedf6fe11c043457c197" + } + Frame { + msec: 1728 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 1744 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 1760 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 1776 + hash: "81110f17d191f9795a2c57d136e86550" + } + Frame { + msec: 1792 + hash: "090a76cf068a5041ff993f21e6ebd087" + } + Frame { + msec: 1808 + hash: "30eb157c89ad0aeb17fd0012afb9246b" + } + Frame { + msec: 1824 + hash: "6b317b59e1b0f5b17a6d7d96e745f576" + } + Frame { + msec: 1840 + hash: "f9fc8467c6dbcb00d1f41a57b550193c" + } + Frame { + msec: 1856 + hash: "744227adbdd31be2920a232ea0dbc85d" + } + Frame { + msec: 1872 + hash: "d4b370ff8c3b66fc8a616dd9b944abd1" + } + Frame { + msec: 1888 + hash: "674b07dc5b99bf2da93c40d42dc9023d" + } + Frame { + msec: 1904 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 1920 + image: "enforcerange.1.png" + } + Frame { + msec: 1936 + hash: "b64810845a97bedf6fe11c043457c197" + } + Frame { + msec: 1952 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 1968 + hash: "70b475e88060ead84d05f0ba1b47c139" + } + Frame { + msec: 1984 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 2000 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 2016 + hash: "81110f17d191f9795a2c57d136e86550" + } + Frame { + msec: 2032 + hash: "090a76cf068a5041ff993f21e6ebd087" + } + Frame { + msec: 2048 + hash: "090a76cf068a5041ff993f21e6ebd087" + } + Frame { + msec: 2064 + hash: "30eb157c89ad0aeb17fd0012afb9246b" + } + Frame { + msec: 2080 + hash: "6b317b59e1b0f5b17a6d7d96e745f576" + } + Frame { + msec: 2096 + hash: "f9fc8467c6dbcb00d1f41a57b550193c" + } + Frame { + msec: 2112 + hash: "f9fc8467c6dbcb00d1f41a57b550193c" + } + Frame { + msec: 2128 + hash: "711274e9b6811b4662ac29d813574fb6" + } + Frame { + msec: 2144 + hash: "744227adbdd31be2920a232ea0dbc85d" + } + Frame { + msec: 2160 + hash: "744227adbdd31be2920a232ea0dbc85d" + } + Frame { + msec: 2176 + hash: "d4b370ff8c3b66fc8a616dd9b944abd1" + } + Frame { + msec: 2192 + hash: "d4b370ff8c3b66fc8a616dd9b944abd1" + } + Frame { + msec: 2208 + hash: "674b07dc5b99bf2da93c40d42dc9023d" + } + Frame { + msec: 2224 + hash: "674b07dc5b99bf2da93c40d42dc9023d" + } + Frame { + msec: 2240 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 2256 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 2272 + hash: "b64810845a97bedf6fe11c043457c197" + } + Frame { + msec: 2288 + hash: "b64810845a97bedf6fe11c043457c197" + } + Frame { + msec: 2304 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 2320 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 2336 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 2352 + hash: "70b475e88060ead84d05f0ba1b47c139" + } + Frame { + msec: 2368 + hash: "70b475e88060ead84d05f0ba1b47c139" + } + Frame { + msec: 2384 + hash: "70b475e88060ead84d05f0ba1b47c139" + } + Frame { + msec: 2400 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 2416 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 2432 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 2448 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 2464 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 2480 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 2496 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 2512 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 2528 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 2544 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 2560 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 2576 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 2592 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 2608 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 2624 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 2640 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 2656 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 2672 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 2688 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 2704 + hash: "70b475e88060ead84d05f0ba1b47c139" + } + Frame { + msec: 2720 + hash: "70b475e88060ead84d05f0ba1b47c139" + } + Frame { + msec: 2736 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 2752 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 2768 + hash: "b64810845a97bedf6fe11c043457c197" + } + Frame { + msec: 2784 + hash: "b64810845a97bedf6fe11c043457c197" + } + Frame { + msec: 2800 + hash: "b64810845a97bedf6fe11c043457c197" + } + Frame { + msec: 2816 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 2832 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 2848 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 2864 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 2880 + image: "enforcerange.2.png" + } + Frame { + msec: 2896 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 2912 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 2928 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 2944 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 2960 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 2976 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 2992 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 3008 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 3024 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 82; y: 39 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3040 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 3056 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 82; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3072 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 82; y: 42 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 81; y: 44 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3088 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 81; y: 47 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 81; y: 55 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3104 + hash: "89016574205e00cf42723446d6a3437e" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 81; y: 60 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 81; y: 69 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3120 + hash: "e2db9b1ae5c4be51a548834a7776da1f" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 80; y: 75 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 80; y: 87 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3136 + hash: "fcfad57224192065782a77ad3398d0d1" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 80; y: 93 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 80; y: 107 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3152 + hash: "bae4fc0fc2d33008ebe827ece94af196" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 84; y: 130 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 88; y: 144 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3168 + hash: "569581944bf18c8165f72c60bdbf1011" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 96; y: 161 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 96; y: 161 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3184 + hash: "613ff94a26bfaa9a4dc94fcbf6c3eb57" + } + Frame { + msec: 3200 + hash: "a63f8e6b194f900acb1b7a332f9fb9ae" + } + Frame { + msec: 3216 + hash: "6c04761cc86d28112c16f692cda58ba4" + } + Frame { + msec: 3232 + hash: "544275da3f7e2ccaedc8c521bf17f59b" + } + Frame { + msec: 3248 + hash: "52831480eb69184341b12ffb09ace736" + } + Frame { + msec: 3264 + hash: "52831480eb69184341b12ffb09ace736" + } + Frame { + msec: 3280 + hash: "52831480eb69184341b12ffb09ace736" + } + Frame { + msec: 3296 + hash: "52831480eb69184341b12ffb09ace736" + } + Frame { + msec: 3312 + hash: "58f2b900bc335424fc70eaaeb23ceb56" + } + Frame { + msec: 3328 + hash: "58f2b900bc335424fc70eaaeb23ceb56" + } + Frame { + msec: 3344 + hash: "544275da3f7e2ccaedc8c521bf17f59b" + } + Frame { + msec: 3360 + hash: "df9fef370c2f6ff300b20fc24b5b9e34" + } + Frame { + msec: 3376 + hash: "99cdc74eefc8c7c7df4650b373d8bc15" + } + Frame { + msec: 3392 + hash: "0662898d246e5ff6981610d32e2b8375" + } + Frame { + msec: 3408 + hash: "651b4c8b7a241263d48e645e603a55a3" + } + Frame { + msec: 3424 + hash: "82b31c8e8794ce3a9a6a635ef93b29b3" + } + Frame { + msec: 3440 + hash: "388658b5e03f3853e93173bd9501b77b" + } + Frame { + msec: 3456 + hash: "cf1856e961e6b8277a82c03ace5ba864" + } + Frame { + msec: 3472 + hash: "e1d022cc1b41098baffe49925b20678f" + } + Frame { + msec: 3488 + hash: "ee55d155fa495f3a0da8c21ad56dfc61" + } + Frame { + msec: 3504 + hash: "044c3712a6a5f6a973defe85643c8d02" + } + Frame { + msec: 3520 + hash: "e4fe2f1a81a4a4806f4155807f285a2d" + } + Frame { + msec: 3536 + hash: "e4fe2f1a81a4a4806f4155807f285a2d" + } + Frame { + msec: 3552 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3568 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3584 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3600 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3616 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3632 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3648 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3664 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3680 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3696 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3712 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3728 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3744 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3760 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3776 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3792 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3808 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3824 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3840 + image: "enforcerange.3.png" + } + Frame { + msec: 3856 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3872 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3888 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3904 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3920 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3936 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3952 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3968 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 3984 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 4000 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 4016 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Frame { + msec: 4032 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 105; y: 169 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4048 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 106; y: 168 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 106; y: 167 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4064 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 106; y: 164 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 106; y: 163 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4080 + hash: "19c43fcf2875769c9a15f1ce317a0f1e" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 106; y: 162 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 106; y: 160 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4096 + hash: "331164730fb7ccf37dc08ddc26c0e182" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 107; y: 157 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 107; y: 156 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4112 + hash: "73e27ff972eefc421bc65897ad8b9a11" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 108; y: 152 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 109; y: 148 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4128 + hash: "c5e903fd827f8f1ec060dcb9a925bf6d" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 109; y: 145 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 109; y: 145 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4144 + hash: "74d4357dff4d6e00c5ae9ea0c34f1010" + } + Frame { + msec: 4160 + hash: "790274ee21ba257b84671a6fb19c142f" + } + Frame { + msec: 4176 + hash: "65ccc26f20be484fefa8ea25a7daf825" + } + Frame { + msec: 4192 + hash: "e435e2fbba7f0f6a65b9fecf07893eb0" + } + Frame { + msec: 4208 + hash: "6a994a18a9331731d5fca50dce2b9cff" + } + Frame { + msec: 4224 + hash: "9fc4405cddc06310215969a4583b2353" + } + Frame { + msec: 4240 + hash: "0d2b7130a84a8efac1cf4fe8a1768231" + } + Frame { + msec: 4256 + hash: "791db15db47090e1af299e5b32e53918" + } + Frame { + msec: 4272 + hash: "0ec6cf7a6ed9a073d2ce8f9e534e2ee5" + } + Frame { + msec: 4288 + hash: "c7b358f51a9500ca4958d266de5307e6" + } + Frame { + msec: 4304 + hash: "d24d00e4cd1ea3aaacf202e2fdf1eaa0" + } + Frame { + msec: 4320 + hash: "169f1a7a933d84071c449132a3c2745e" + } + Frame { + msec: 4336 + hash: "b6bf9c15ed40d6e862f693155c884035" + } + Frame { + msec: 4352 + hash: "8639955aa7a03f54d50d7e9051a4b997" + } + Frame { + msec: 4368 + hash: "411bc9a9aedbfb75f3122eaea6be0c16" + } + Frame { + msec: 4384 + hash: "827094da86716daf69386af2c8d4027a" + } + Frame { + msec: 4400 + hash: "ddddd5457e4a54ca5e7415dc2c7eabe5" + } + Frame { + msec: 4416 + hash: "632a5756af20083504fb1faaa019dd48" + } + Frame { + msec: 4432 + hash: "0cc2901b1b25412f13865887a8c9d13e" + } + Frame { + msec: 4448 + hash: "4c8a9473eb9843634340d70f8eab9487" + } + Frame { + msec: 4464 + hash: "398a238f59a2edf07870b624b914c81d" + } + Frame { + msec: 4480 + hash: "a7c282235e9166b900ea2ff68800a5f5" + } + Frame { + msec: 4496 + hash: "bae4fc0fc2d33008ebe827ece94af196" + } + Frame { + msec: 4512 + hash: "45e0670a2b4c18b847a3c7870539b962" + } + Frame { + msec: 4528 + hash: "8d474956331fdd0c35beb13a06b7c557" + } + Frame { + msec: 4544 + hash: "5d5bdffc30d90fd5b061c6fcf24c2599" + } + Frame { + msec: 4560 + hash: "15721b103981f5fe40b5dfe7d65c5b38" + } + Frame { + msec: 4576 + hash: "940b70f15082ff138579892bb6f20ce9" + } + Frame { + msec: 4592 + hash: "5137ea98fd291a4b967fb66d93253a37" + } + Frame { + msec: 4608 + hash: "35ab744ce2a91567dbbd769f9486f870" + } + Frame { + msec: 4624 + hash: "d5c55c00b07735e5d7c02dfa99ef2f45" + } + Frame { + msec: 4640 + hash: "6b2d32b8f1df871c2c014af8b5d87329" + } + Frame { + msec: 4656 + hash: "edf3b33b80cca53999779555f9cd6162" + } + Frame { + msec: 4672 + hash: "180f3cc4ea5ff5b6f9e8be0294732d4e" + } + Frame { + msec: 4688 + hash: "9b99a1b0c0bb0ce37655d92854ee4d19" + } + Frame { + msec: 4704 + hash: "28e9ca60a873910380b2d22d6b3df565" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 109; y: 131 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4720 + hash: "28e9ca60a873910380b2d22d6b3df565" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 109; y: 126 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 109; y: 124 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4736 + hash: "18e53bf6337cf6590fc3c73c00469d8e" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 109; y: 115 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 109; y: 110 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4752 + hash: "81110f17d191f9795a2c57d136e86550" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 108; y: 99 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 106; y: 85 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4768 + hash: "b64810845a97bedf6fe11c043457c197" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 105; y: 74 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 103; y: 60 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4784 + hash: "711274e9b6811b4662ac29d813574fb6" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 102; y: 54 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 100; y: 40 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 100; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4800 + image: "enforcerange.4.png" + } + Frame { + msec: 4816 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 4832 + hash: "090a76cf068a5041ff993f21e6ebd087" + } + Frame { + msec: 4848 + hash: "6b317b59e1b0f5b17a6d7d96e745f576" + } + Frame { + msec: 4864 + hash: "744227adbdd31be2920a232ea0dbc85d" + } + Frame { + msec: 4880 + hash: "674b07dc5b99bf2da93c40d42dc9023d" + } + Frame { + msec: 4896 + hash: "b64810845a97bedf6fe11c043457c197" + } + Frame { + msec: 4912 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 4928 + hash: "81110f17d191f9795a2c57d136e86550" + } + Frame { + msec: 4944 + hash: "30eb157c89ad0aeb17fd0012afb9246b" + } + Frame { + msec: 4960 + hash: "f9fc8467c6dbcb00d1f41a57b550193c" + } + Frame { + msec: 4976 + hash: "711274e9b6811b4662ac29d813574fb6" + } + Frame { + msec: 4992 + hash: "d4b370ff8c3b66fc8a616dd9b944abd1" + } + Frame { + msec: 5008 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 5024 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 5040 + hash: "70b475e88060ead84d05f0ba1b47c139" + } + Frame { + msec: 5056 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 5072 + hash: "81110f17d191f9795a2c57d136e86550" + } + Frame { + msec: 5088 + hash: "30eb157c89ad0aeb17fd0012afb9246b" + } + Frame { + msec: 5104 + hash: "6b317b59e1b0f5b17a6d7d96e745f576" + } + Frame { + msec: 5120 + hash: "711274e9b6811b4662ac29d813574fb6" + } + Frame { + msec: 5136 + hash: "744227adbdd31be2920a232ea0dbc85d" + } + Frame { + msec: 5152 + hash: "674b07dc5b99bf2da93c40d42dc9023d" + } + Frame { + msec: 5168 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 5184 + hash: "b64810845a97bedf6fe11c043457c197" + } + Frame { + msec: 5200 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 5216 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 5232 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 5248 + hash: "81110f17d191f9795a2c57d136e86550" + } + Frame { + msec: 5264 + hash: "090a76cf068a5041ff993f21e6ebd087" + } + Frame { + msec: 5280 + hash: "30eb157c89ad0aeb17fd0012afb9246b" + } + Frame { + msec: 5296 + hash: "6b317b59e1b0f5b17a6d7d96e745f576" + } + Frame { + msec: 5312 + hash: "f9fc8467c6dbcb00d1f41a57b550193c" + } + Frame { + msec: 5328 + hash: "744227adbdd31be2920a232ea0dbc85d" + } + Frame { + msec: 5344 + hash: "d4b370ff8c3b66fc8a616dd9b944abd1" + } + Frame { + msec: 5360 + hash: "674b07dc5b99bf2da93c40d42dc9023d" + } + Frame { + msec: 5376 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 5392 + hash: "b64810845a97bedf6fe11c043457c197" + } + Frame { + msec: 5408 + hash: "b64810845a97bedf6fe11c043457c197" + } + Frame { + msec: 5424 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 5440 + hash: "70b475e88060ead84d05f0ba1b47c139" + } + Frame { + msec: 5456 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 5472 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 5488 + hash: "81110f17d191f9795a2c57d136e86550" + } + Frame { + msec: 5504 + hash: "090a76cf068a5041ff993f21e6ebd087" + } + Frame { + msec: 5520 + hash: "090a76cf068a5041ff993f21e6ebd087" + } + Frame { + msec: 5536 + hash: "30eb157c89ad0aeb17fd0012afb9246b" + } + Frame { + msec: 5552 + hash: "6b317b59e1b0f5b17a6d7d96e745f576" + } + Frame { + msec: 5568 + hash: "f9fc8467c6dbcb00d1f41a57b550193c" + } + Frame { + msec: 5584 + hash: "f9fc8467c6dbcb00d1f41a57b550193c" + } + Frame { + msec: 5600 + hash: "711274e9b6811b4662ac29d813574fb6" + } + Frame { + msec: 5616 + hash: "744227adbdd31be2920a232ea0dbc85d" + } + Frame { + msec: 5632 + hash: "744227adbdd31be2920a232ea0dbc85d" + } + Frame { + msec: 5648 + hash: "d4b370ff8c3b66fc8a616dd9b944abd1" + } + Frame { + msec: 5664 + hash: "d4b370ff8c3b66fc8a616dd9b944abd1" + } + Frame { + msec: 5680 + hash: "674b07dc5b99bf2da93c40d42dc9023d" + } + Frame { + msec: 5696 + hash: "674b07dc5b99bf2da93c40d42dc9023d" + } + Frame { + msec: 5712 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 5728 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 5744 + hash: "b64810845a97bedf6fe11c043457c197" + } + Frame { + msec: 5760 + image: "enforcerange.5.png" + } + Frame { + msec: 5776 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 5792 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 5808 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 5824 + hash: "70b475e88060ead84d05f0ba1b47c139" + } + Frame { + msec: 5840 + hash: "70b475e88060ead84d05f0ba1b47c139" + } + Frame { + msec: 5856 + hash: "70b475e88060ead84d05f0ba1b47c139" + } + Frame { + msec: 5872 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 5888 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 5904 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 5920 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 5936 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 5952 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 5968 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 5984 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 6000 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 6016 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 6032 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 6048 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 6064 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 6080 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 6096 + hash: "b061ee3784fbd4a287758ffd100a623e" + } + Frame { + msec: 6112 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 6128 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 6144 + hash: "7eb75e8e83874d52448a7dbf6a0ad29c" + } + Frame { + msec: 6160 + hash: "70b475e88060ead84d05f0ba1b47c139" + } + Frame { + msec: 6176 + hash: "70b475e88060ead84d05f0ba1b47c139" + } + Frame { + msec: 6192 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 6208 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 6224 + hash: "87aaa82b96131fed8822e57e226162a0" + } + Frame { + msec: 6240 + hash: "b64810845a97bedf6fe11c043457c197" + } + Frame { + msec: 6256 + hash: "b64810845a97bedf6fe11c043457c197" + } + Frame { + msec: 6272 + hash: "b64810845a97bedf6fe11c043457c197" + } + Frame { + msec: 6288 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6304 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6320 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6336 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6352 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6368 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6384 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6400 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6416 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6432 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6448 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6464 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6480 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6496 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6512 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6528 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6544 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6560 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6576 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6592 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6608 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6624 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6640 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } + Frame { + msec: 6656 + hash: "a4ff6c6c43697808f9ad7387d152cef3" + } +} diff --git a/tests/auto/declarative/qmlvisual/ListView/enforcerange.qml b/tests/auto/declarative/qmlvisual/ListView/enforcerange.qml new file mode 100644 index 0000000..a796be7 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/ListView/enforcerange.qml @@ -0,0 +1,31 @@ +import QtQuick 1.0 + +Item { + id: document + width: 200; height: 200 + + ListView { + id: serviceListView + anchors.fill: parent + model: 100 + + preferredHighlightBegin: 90 + preferredHighlightEnd: 90 + + highlightRangeMode: ListView.StrictlyEnforceRange + + delegate: Component { + Item { + height: 15 + ((serviceListView.currentIndex == index) ? 20 : 0) + width: 200 + Rectangle { width: 180; height: parent.height - 4; x: 10; y: 2; color: "red" } + } + } + } + + Rectangle { + y: 90; width: 200; height: 35 + border.color: "black" + color: "transparent" + } +} -- cgit v0.12 From 3cc9c5f2541f192733436c79c4d14aa34177c3cc Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 3 Nov 2010 16:38:20 +1000 Subject: highlightranges.qml example and visual test contained binding loop. Also, the currentIndex stayed -1 since the views all bound to each others currentIndex, which starts as -1. Task-number: QTBUG-14794 Reviewed-by: Yann Bodson --- .../modelviews/listview/highlightranges.qml | 20 +++++++++++--------- .../auto/declarative/qmlvisual/ListView/listview.qml | 12 ++++++++---- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/examples/declarative/modelviews/listview/highlightranges.qml b/examples/declarative/modelviews/listview/highlightranges.qml index 2716ee5..58d37a3 100644 --- a/examples/declarative/modelviews/listview/highlightranges.qml +++ b/examples/declarative/modelviews/listview/highlightranges.qml @@ -42,15 +42,14 @@ import QtQuick 1.0 import "content" Rectangle { + id: root + property int current: 0 width: 600; height: 300 // This example shows the same model in three different ListView items, // with different highlight ranges. The highlight ranges are set by the // preferredHighlightBegin and preferredHighlightEnd properties in ListView. // - // The second and third ListViews set their currentIndex to be the - // same as the first. The first ListView is given keyboard focus. - // // The first ListView does not set a highlight range, so its currentItem // can move freely within the visible area. If it moves outside the // visible area, the view is automatically scrolled to keep the current @@ -66,9 +65,10 @@ Rectangle { // forces the current item to change when the view is flicked, // since the highlight is unable to move. // - // Note that the first ListView sets its currentIndex to be equal to - // the third ListView's currentIndex. By flicking the third ListView with - // the mouse, the current index of the first ListView will be changed. + // All ListViews bind their currentIndex to the root.current property. + // The first ListView sets root.current whenever its currentIndex changes + // due to keyboard interaction. + // Flicking the third ListView with the mouse also changes root.current. ListView { id: list1 @@ -77,7 +77,8 @@ Rectangle { delegate: petDelegate highlight: Rectangle { color: "lightsteelblue" } - currentIndex: list3.currentIndex + currentIndex: root.current + onCurrentIndexChanged: root.current = currentIndex focus: true } @@ -89,7 +90,7 @@ Rectangle { delegate: petDelegate highlight: Rectangle { color: "yellow" } - currentIndex: list1.currentIndex + currentIndex: root.current preferredHighlightBegin: 80; preferredHighlightEnd: 220 highlightRangeMode: ListView.ApplyRange } @@ -102,7 +103,8 @@ Rectangle { delegate: petDelegate highlight: Rectangle { color: "yellow" } - currentIndex: list1.currentIndex + currentIndex: root.current + onCurrentIndexChanged: root.current = currentIndex preferredHighlightBegin: 125; preferredHighlightEnd: 125 highlightRangeMode: ListView.StrictlyEnforceRange } diff --git a/tests/auto/declarative/qmlvisual/ListView/listview.qml b/tests/auto/declarative/qmlvisual/ListView/listview.qml index 43c86a0..6171c75 100644 --- a/tests/auto/declarative/qmlvisual/ListView/listview.qml +++ b/tests/auto/declarative/qmlvisual/ListView/listview.qml @@ -1,7 +1,8 @@ import QtQuick 1.0 Rectangle { - property string skip: "Incorrect start: QTBUG-14794" + id: root + property int current: 0 width: 600; height: 300; color: "white" ListModel { @@ -57,7 +58,9 @@ Rectangle { id: list1 width: 200; height: parent.height model: myModel; delegate: myDelegate - highlight: myHighlight; currentIndex: list3.currentIndex + highlight: myHighlight + currentIndex: root.current + onCurrentIndexChanged: root.current = currentIndex focus: true } ListView { @@ -67,13 +70,14 @@ Rectangle { preferredHighlightBegin: 80 preferredHighlightEnd: 220 highlightRangeMode: "ApplyRange" - currentIndex: list1.currentIndex + currentIndex: root.current } ListView { id: list3 x: 400; width: 200; height: parent.height model: myModel; delegate: myDelegate; highlight: myHighlight - currentIndex: list1.currentIndex + currentIndex: root.current + onCurrentIndexChanged: root.current = currentIndex preferredHighlightBegin: 125 preferredHighlightEnd: 125 highlightRangeMode: "StrictlyEnforceRange" -- cgit v0.12 From 59d4e2022095d8363cd5373a1a74f86a448c3542 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 4 Nov 2010 12:41:28 +1000 Subject: Add testcase for QTBUG-13719. --- .../data/ConstantsOverrideBindings.qml | 6 ++++++ .../data/constantsOverrideBindings.4.qml | 11 +++++++++++ .../qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 15 +++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.4.qml diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/ConstantsOverrideBindings.qml b/tests/auto/declarative/qdeclarativeecmascript/data/ConstantsOverrideBindings.qml index b4a702b..07bb16b 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/ConstantsOverrideBindings.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/ConstantsOverrideBindings.qml @@ -3,4 +3,10 @@ import Qt.test 1.0 MyQmlObject { property int c1: 0 property int c2: c1 + property alias c3: inner.ic1 + + objectProperty: MyQmlObject { + id: inner + property int ic1: c1 + } } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.4.qml new file mode 100644 index 0000000..5a2091f --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.4.qml @@ -0,0 +1,11 @@ +import Qt.test 1.0 + +MyQmlObject { + property alias c1: myConstants.c1 + property alias c3: myConstants.c3 + + objectProperty: ConstantsOverrideBindings { + id: myConstants + c3: 10 + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 72e2e10..3dd69da 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -733,6 +733,21 @@ void tst_qdeclarativeecmascript::constantsOverrideBindings() QCOMPARE(object->property("c2").toInt(), 13); } #endif + + // Using an alias + { + QDeclarativeComponent component(&engine, TEST_FILE("constantsOverrideBindings.4.qml")); + MyQmlObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("c1").toInt(), 0); + QEXPECT_FAIL("", "QTBUG-13719", Continue); + QCOMPARE(object->property("c3").toInt(), 10); + object->setProperty("c1", QVariant(9)); + QCOMPARE(object->property("c1").toInt(), 9); + QEXPECT_FAIL("", "QTBUG-13719", Continue); + QCOMPARE(object->property("c3").toInt(), 10); + } } /* -- cgit v0.12 From f1344a817fdb3d263bd64f4440fedc73ad94ad31 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 4 Nov 2010 13:00:50 +1000 Subject: Don't emit xChanged()/yChanged() twice. Once from QGraphicsObject (QGraphicsItemPrivate::setPosHelper()) and once from QDeclarativeItem::geometryChanged(). Remove from geometryChanged(). Task-number: QTBUG-14942 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 4 ---- .../auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp | 10 ++++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 95a4fd6..e0df751 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1955,12 +1955,8 @@ void QDeclarativeItem::geometryChanged(const QRectF &newGeometry, change.listener->itemGeometryChanged(this, newGeometry, oldGeometry); } - if (newGeometry.x() != oldGeometry.x()) - emit xChanged(); if (newGeometry.width() != oldGeometry.width()) emit widthChanged(); - if (newGeometry.y() != oldGeometry.y()) - emit yChanged(); if (newGeometry.height() != oldGeometry.height()) emit heightChanged(); } diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index b4903ae..711bf00 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -686,6 +686,8 @@ void tst_QDeclarativeItem::propertyChanges() QSignalSpy focusSpy(item, SIGNAL(focusChanged(bool))); QSignalSpy wantsFocusSpy(parentItem, SIGNAL(activeFocusChanged(bool))); QSignalSpy childrenChangedSpy(parentItem, SIGNAL(childrenChanged())); + QSignalSpy xSpy(item, SIGNAL(xChanged())); + QSignalSpy ySpy(item, SIGNAL(yChanged())); item->setParentItem(parentItem); item->setWidth(100.0); @@ -731,6 +733,14 @@ void tst_QDeclarativeItem::propertyChanges() QCOMPARE(parentItem->hasFocus(), false); QCOMPARE(wantsFocusSpy.count(),0); + item->setX(10.0); + QCOMPARE(item->x(), 10.0); + QCOMPARE(xSpy.count(), 1); + + item->setY(10.0); + QCOMPARE(item->y(), 10.0); + QCOMPARE(ySpy.count(), 1); + delete canvas; } -- cgit v0.12 From 80544a90d165736088b8286b738fd4e3033b1ade Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 4 Nov 2010 15:07:24 +1000 Subject: Fix regression in 648eb76c and update visual tests. Once fixup() begins, flick should not be recalculated. Task-number: QTBUG-14821 Reviewed-by: Michael Brasser --- .../graphicsitems/qdeclarativelistview.cpp | 1 + .../qmlvisual/ListView/data/enforcerange.qml | 30 +- .../qmlvisual/ListView/data/itemlist.0.png | Bin 976 -> 976 bytes .../qmlvisual/ListView/data/itemlist.1.png | Bin 986 -> 986 bytes .../qmlvisual/ListView/data/itemlist.2.png | Bin 977 -> 977 bytes .../qmlvisual/ListView/data/itemlist.3.png | Bin 977 -> 977 bytes .../qmlvisual/ListView/data/itemlist.4.png | Bin 977 -> 977 bytes .../qmlvisual/ListView/data/itemlist.5.png | Bin 990 -> 990 bytes .../qmlvisual/ListView/data/itemlist.6.png | Bin 976 -> 976 bytes .../qmlvisual/ListView/data/itemlist.qml | 104 ++-- .../qmlvisual/ListView/data/listview.0.png | Bin 1580 -> 1585 bytes .../qmlvisual/ListView/data/listview.1.png | Bin 1580 -> 1580 bytes .../qmlvisual/ListView/data/listview.2.png | Bin 1661 -> 1667 bytes .../qmlvisual/ListView/data/listview.3.png | Bin 1649 -> 1599 bytes .../qmlvisual/ListView/data/listview.4.png | Bin 1669 -> 1663 bytes .../qmlvisual/ListView/data/listview.5.png | Bin 1651 -> 1666 bytes .../qmlvisual/ListView/data/listview.qml | 604 ++++++++++----------- 17 files changed, 370 insertions(+), 369 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index eab66d8..94b1cb3 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1157,6 +1157,7 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m || (orient == QDeclarativeListView::Vertical && &data == &hData)) return; + correctFlick = false; int oldDuration = fixupDuration; fixupDuration = moveReason == Mouse ? fixupDuration : 0; diff --git a/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.qml b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.qml index c15b657..20ed077 100644 --- a/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.qml +++ b/tests/auto/declarative/qmlvisual/ListView/data/enforcerange.qml @@ -1074,7 +1074,7 @@ VisualTest { } Frame { msec: 3296 - hash: "52831480eb69184341b12ffb09ace736" + hash: "58f2b900bc335424fc70eaaeb23ceb56" } Frame { msec: 3312 @@ -1082,59 +1082,59 @@ VisualTest { } Frame { msec: 3328 - hash: "58f2b900bc335424fc70eaaeb23ceb56" + hash: "544275da3f7e2ccaedc8c521bf17f59b" } Frame { msec: 3344 - hash: "544275da3f7e2ccaedc8c521bf17f59b" + hash: "df9fef370c2f6ff300b20fc24b5b9e34" } Frame { msec: 3360 - hash: "df9fef370c2f6ff300b20fc24b5b9e34" + hash: "0662898d246e5ff6981610d32e2b8375" } Frame { msec: 3376 - hash: "99cdc74eefc8c7c7df4650b373d8bc15" + hash: "6c04761cc86d28112c16f692cda58ba4" } Frame { msec: 3392 - hash: "0662898d246e5ff6981610d32e2b8375" + hash: "82b31c8e8794ce3a9a6a635ef93b29b3" } Frame { msec: 3408 - hash: "651b4c8b7a241263d48e645e603a55a3" + hash: "388658b5e03f3853e93173bd9501b77b" } Frame { msec: 3424 - hash: "82b31c8e8794ce3a9a6a635ef93b29b3" + hash: "cf1856e961e6b8277a82c03ace5ba864" } Frame { msec: 3440 - hash: "388658b5e03f3853e93173bd9501b77b" + hash: "e1d022cc1b41098baffe49925b20678f" } Frame { msec: 3456 - hash: "cf1856e961e6b8277a82c03ace5ba864" + hash: "a63f8e6b194f900acb1b7a332f9fb9ae" } Frame { msec: 3472 - hash: "e1d022cc1b41098baffe49925b20678f" + hash: "044c3712a6a5f6a973defe85643c8d02" } Frame { msec: 3488 - hash: "ee55d155fa495f3a0da8c21ad56dfc61" + hash: "044c3712a6a5f6a973defe85643c8d02" } Frame { msec: 3504 - hash: "044c3712a6a5f6a973defe85643c8d02" + hash: "e4fe2f1a81a4a4806f4155807f285a2d" } Frame { msec: 3520 - hash: "e4fe2f1a81a4a4806f4155807f285a2d" + hash: "19c43fcf2875769c9a15f1ce317a0f1e" } Frame { msec: 3536 - hash: "e4fe2f1a81a4a4806f4155807f285a2d" + hash: "19c43fcf2875769c9a15f1ce317a0f1e" } Frame { msec: 3552 diff --git a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.0.png b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.0.png index 75d2089..6a589c6 100644 Binary files a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.0.png and b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.0.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.1.png b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.1.png index 578b7d1..a8957d6 100644 Binary files a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.1.png and b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.1.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.2.png b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.2.png index def378f..fe2d28b 100644 Binary files a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.2.png and b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.2.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.3.png b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.3.png index e23b903..0f20b07 100644 Binary files a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.3.png and b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.3.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.4.png b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.4.png index def378f..fe2d28b 100644 Binary files a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.4.png and b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.4.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.5.png b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.5.png index b81e713..0ab58c5 100644 Binary files a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.5.png and b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.5.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.6.png b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.6.png index 75d2089..6a589c6 100644 Binary files a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.6.png and b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.6.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.qml b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.qml index b23594b..6d09bc0 100644 --- a/tests/auto/declarative/qmlvisual/ListView/data/itemlist.qml +++ b/tests/auto/declarative/qmlvisual/ListView/data/itemlist.qml @@ -982,67 +982,67 @@ VisualTest { } Frame { msec: 3088 - hash: "4b5368f0d86bffeb6bd31b58aec88650" + hash: "fd8e51cca3432f6edcf949857737095f" } Frame { msec: 3104 - hash: "3f4c24f7ac89da982af22032309637fb" + hash: "aa5d4e65932b3ec2f5549079dfc7718d" } Frame { msec: 3120 - hash: "8cacde33b70fc62b9b0c753091168b97" + hash: "f811f3c6b022730dd68ebd7b1659ea40" } Frame { msec: 3136 - hash: "7b8c1bb2a3ab9ba23ac17dc5422adac8" + hash: "e51a2e41972cfc3df46a7d4375024d80" } Frame { msec: 3152 - hash: "5aa34dccdd406b7e93dfdf756bbca5f0" + hash: "275f3594a0e2cc4b6717f9f336e7e1b6" } Frame { msec: 3168 - hash: "4865c30dc45fbf5ca82047b77eca0912" + hash: "9229054bb70662b12a4f7e45ac5b7a90" } Frame { msec: 3184 - hash: "1dcecc3a899b060a1469ef91e0d21765" + hash: "89ff346eca0b71cad3b04a2cb8064fb0" } Frame { msec: 3200 - hash: "31422699bdbbbf827f7bb1f1ef78823e" + hash: "94e6ecb87a7efca6344d6d63a1e3829f" } Frame { msec: 3216 - hash: "5859920a625ef94a644fda85d14e92fb" + hash: "bc5eb6b0eeae316ddd0b308da2cc32e2" } Frame { msec: 3232 - hash: "37f1f7aaeaed28807f51fd9ad8c414ac" + hash: "240081760f0cf2f02be4d6d2600d2bbc" } Frame { msec: 3248 - hash: "14592a6c86f211c20abab5cf34a406b4" + hash: "69b335aeb81fc2ae6173f2ec5cdc4c55" } Frame { msec: 3264 - hash: "77c18ac7dfff2a4e516915e3e3df0717" + hash: "10d481e57cc8cd694500d9ed6ae1f8bb" } Frame { msec: 3280 - hash: "f619097356671f6eb54d3b1c481e709d" + hash: "6b21f71d0bedef4bbcb445a13f61e7a3" } Frame { msec: 3296 - hash: "7f19ea52e9e41a3b1bd90bb2a144d305" + hash: "aa94ebdbb4b8423aff28c95daff0baf5" } Frame { msec: 3312 - hash: "17deb6b26fc9d27d5194995c102da4ac" + hash: "5f6708f615654c459f5749676fc09016" } Frame { msec: 3328 - hash: "29c52328b54f02cc9042f676d710b9b2" + hash: "8ef246d322446e7f0848b99495f89e2b" } Frame { msec: 3344 @@ -1050,11 +1050,11 @@ VisualTest { } Frame { msec: 3360 - hash: "40204fdb7a84b86f1380224908092354" + hash: "3b2e2d957585fb44a7165186a146892c" } Frame { msec: 3376 - hash: "de7f3c83f37cc89c87009626c72e7642" + hash: "124da0099a7dd6fbf6dfd0ecfb09638c" } Frame { msec: 3392 @@ -1074,7 +1074,7 @@ VisualTest { } Frame { msec: 3456 - hash: "b554512bac0766063870c5b3acb1d24f" + hash: "bb5ea2a238920a8486263bc7450edfb4" } Frame { msec: 3472 @@ -1082,7 +1082,7 @@ VisualTest { } Frame { msec: 3488 - hash: "e4dacafba5ab5f8db53f08cef458cf42" + hash: "b554512bac0766063870c5b3acb1d24f" } Frame { msec: 3504 @@ -1094,23 +1094,23 @@ VisualTest { } Frame { msec: 3536 - hash: "40204fdb7a84b86f1380224908092354" + hash: "124da0099a7dd6fbf6dfd0ecfb09638c" } Frame { msec: 3552 - hash: "3b2e2d957585fb44a7165186a146892c" + hash: "40204fdb7a84b86f1380224908092354" } Frame { msec: 3568 - hash: "c3b219bdd7710427d134402a8d3e6429" + hash: "ff93c3290b7d9a9743cc11d41a112a0a" } Frame { msec: 3584 - hash: "8d424f37bb6af879129e57661d30a162" + hash: "c3b219bdd7710427d134402a8d3e6429" } Frame { msec: 3600 - hash: "29c52328b54f02cc9042f676d710b9b2" + hash: "56e2f6b2ac103caf7ada3b56c19622c2" } Frame { msec: 3616 @@ -1118,15 +1118,15 @@ VisualTest { } Frame { msec: 3632 - hash: "17deb6b26fc9d27d5194995c102da4ac" + hash: "8eb6d69d9833d0fbf87f951f489b71fe" } Frame { msec: 3648 - hash: "5f6708f615654c459f5749676fc09016" + hash: "17deb6b26fc9d27d5194995c102da4ac" } Frame { msec: 3664 - hash: "1734205ea5e7539b47d80c5a93ec74aa" + hash: "5f6708f615654c459f5749676fc09016" } Frame { msec: 3680 @@ -1134,7 +1134,7 @@ VisualTest { } Frame { msec: 3696 - hash: "88143ff6c278a5433b314b551b7b8b1d" + hash: "1734205ea5e7539b47d80c5a93ec74aa" } Frame { msec: 3712 @@ -1722,7 +1722,7 @@ VisualTest { } Frame { msec: 5408 - hash: "cf2acc805e9707327b01eb979f2b67a3" + hash: "06ce7db518da042e04dd3f79b7220974" } Frame { msec: 5424 @@ -1730,55 +1730,55 @@ VisualTest { } Frame { msec: 5440 - hash: "a978890b419f9503e53d4d3f4f9b8c9b" + hash: "53e9d5a0098f2e91bbea45360b876607" } Frame { msec: 5456 - hash: "73339b67e49210b4760b8e06fa4067b7" + hash: "22a6c7f3dcb5a36592909783b2466c8d" } Frame { msec: 5472 - hash: "d09a245890e813c248050132a76465f3" + hash: "9d8da9199efebb95f56e5d4ebc9a585e" } Frame { msec: 5488 - hash: "35b874b3b4d7d1e59852233fce192b0b" + hash: "c553400402f233a6246be4e544b433ae" } Frame { msec: 5504 - hash: "4f80a0da1941e9c208036f22df93bed8" + hash: "c2e41a54c03340832db93f6f88393f00" } Frame { msec: 5520 - hash: "7bbdc4ce95bc12e505f24cb8b137a0f1" + hash: "3622a619a99c939e96636a86c4428ba3" } Frame { msec: 5536 - hash: "e68b5fb604a45d4e7ee21f6e06460b47" + hash: "e65d5e6c756e750e6d98096fe211465c" } Frame { msec: 5552 - hash: "903059d468bed1ac8395e38a19c9dd38" + hash: "cabd6d30b1f4e42b38b73803aae6d5be" } Frame { msec: 5568 - hash: "d7430ebf26f2de6f648471c19455cf0f" + hash: "68d443f16c16821ffc9ca68b17c76034" } Frame { msec: 5584 - hash: "d5268cd58c222451d48038e715e83802" + hash: "a68b1bc6c2963ee92c3a45f500667b3b" } Frame { msec: 5600 - hash: "99b4534b0bf58dc8e28c1118a5baec33" + hash: "805319ac7ca842feb3649e92f8b5b72f" } Frame { msec: 5616 - hash: "ade5beb259b5277c333ca806fc9bdbec" + hash: "fd8d3f5688b1806998c6087e18c6c730" } Frame { msec: 5632 - hash: "f34d2248999f5f51210064315d631f60" + hash: "b135c8c9975f4d45d2054cf31d0b1fe1" } Frame { msec: 5648 @@ -1786,7 +1786,7 @@ VisualTest { } Frame { msec: 5664 - hash: "65af7a4a4aea5a983ea3fb9324e74256" + hash: "aa32e4c20c6a43c4ef7991a9418e57fe" } Frame { msec: 5680 @@ -1794,7 +1794,7 @@ VisualTest { } Frame { msec: 5696 - hash: "2311ce1a83a43619ab7ce537a2b948e1" + hash: "127871a98123b7bd44f4c38f27cbc836" } Frame { msec: 5712 @@ -1826,15 +1826,15 @@ VisualTest { } Frame { msec: 5824 - hash: "127871a98123b7bd44f4c38f27cbc836" + hash: "2311ce1a83a43619ab7ce537a2b948e1" } Frame { msec: 5840 - hash: "b8db9180b4ad15fdbd25a4e974512f92" + hash: "127871a98123b7bd44f4c38f27cbc836" } Frame { msec: 5856 - hash: "0974df6a7277bba11a3d3f400c68f4f1" + hash: "b8db9180b4ad15fdbd25a4e974512f92" } Frame { msec: 5872 @@ -1842,11 +1842,11 @@ VisualTest { } Frame { msec: 5888 - hash: "b3e92eb4cfe548b92ac526066dfc7d23" + hash: "aa32e4c20c6a43c4ef7991a9418e57fe" } Frame { msec: 5904 - hash: "40382f644935dc4e99353fa29c3e0b21" + hash: "b3e92eb4cfe548b92ac526066dfc7d23" } Frame { msec: 5920 @@ -1862,7 +1862,7 @@ VisualTest { } Frame { msec: 5968 - hash: "b135c8c9975f4d45d2054cf31d0b1fe1" + hash: "f34d2248999f5f51210064315d631f60" } Frame { msec: 5984 @@ -1870,7 +1870,7 @@ VisualTest { } Frame { msec: 6000 - hash: "bf47cc398a702dd17c8efebb3d2f8073" + hash: "b135c8c9975f4d45d2054cf31d0b1fe1" } Frame { msec: 6016 diff --git a/tests/auto/declarative/qmlvisual/ListView/data/listview.0.png b/tests/auto/declarative/qmlvisual/ListView/data/listview.0.png index 78c1c27..c7fa695 100644 Binary files a/tests/auto/declarative/qmlvisual/ListView/data/listview.0.png and b/tests/auto/declarative/qmlvisual/ListView/data/listview.0.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/listview.1.png b/tests/auto/declarative/qmlvisual/ListView/data/listview.1.png index ecd1e01..b6c5e19 100644 Binary files a/tests/auto/declarative/qmlvisual/ListView/data/listview.1.png and b/tests/auto/declarative/qmlvisual/ListView/data/listview.1.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/listview.2.png b/tests/auto/declarative/qmlvisual/ListView/data/listview.2.png index ba1733f..711c47a 100644 Binary files a/tests/auto/declarative/qmlvisual/ListView/data/listview.2.png and b/tests/auto/declarative/qmlvisual/ListView/data/listview.2.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/listview.3.png b/tests/auto/declarative/qmlvisual/ListView/data/listview.3.png index 7a393d1..e56fae0 100644 Binary files a/tests/auto/declarative/qmlvisual/ListView/data/listview.3.png and b/tests/auto/declarative/qmlvisual/ListView/data/listview.3.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/listview.4.png b/tests/auto/declarative/qmlvisual/ListView/data/listview.4.png index cb73ca9..0030842 100644 Binary files a/tests/auto/declarative/qmlvisual/ListView/data/listview.4.png and b/tests/auto/declarative/qmlvisual/ListView/data/listview.4.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/listview.5.png b/tests/auto/declarative/qmlvisual/ListView/data/listview.5.png index cbbe6d7..2ec8177 100644 Binary files a/tests/auto/declarative/qmlvisual/ListView/data/listview.5.png and b/tests/auto/declarative/qmlvisual/ListView/data/listview.5.png differ diff --git a/tests/auto/declarative/qmlvisual/ListView/data/listview.qml b/tests/auto/declarative/qmlvisual/ListView/data/listview.qml index 1db722f..45f96e1 100644 --- a/tests/auto/declarative/qmlvisual/ListView/data/listview.qml +++ b/tests/auto/declarative/qmlvisual/ListView/data/listview.qml @@ -6,107 +6,107 @@ VisualTest { } Frame { msec: 16 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 32 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 48 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 64 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 80 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 96 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 112 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 128 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 144 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 160 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 176 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 192 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 208 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 224 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 240 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 256 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 272 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 288 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 304 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 320 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 336 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 352 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 368 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 384 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 400 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Frame { msec: 416 - hash: "95c48087b681f0bcb09b2d7aad1a0299" + hash: "3b88645092be28037fca4a6034f5b2f7" } Key { type: 6 @@ -122,15 +122,15 @@ VisualTest { } Frame { msec: 448 - hash: "3b88645092be28037fca4a6034f5b2f7" + hash: "435ac0668ad4d0e196eb040d385053cb" } Frame { msec: 464 - hash: "3b88645092be28037fca4a6034f5b2f7" + hash: "e9532fe1acc1c27a2119e6dde3e01637" } Frame { msec: 480 - hash: "3b88645092be28037fca4a6034f5b2f7" + hash: "9c757feaf5a8d1e88c659fca97e3b7b2" } Key { type: 7 @@ -142,35 +142,35 @@ VisualTest { } Frame { msec: 496 - hash: "3b88645092be28037fca4a6034f5b2f7" + hash: "ccc7785a45a41615db01580835a4638e" } Frame { msec: 512 - hash: "3b88645092be28037fca4a6034f5b2f7" + hash: "11ad92022bcd5d3fbd28ffb9f51c69eb" } Frame { msec: 528 - hash: "3b88645092be28037fca4a6034f5b2f7" + hash: "a8a94e1f95216864c368b8c3d0ae682b" } Frame { msec: 544 - hash: "3b88645092be28037fca4a6034f5b2f7" + hash: "d83e213d35e7fcff2580b4e197547f24" } Frame { msec: 560 - hash: "3b88645092be28037fca4a6034f5b2f7" + hash: "9e5a57fabdc443e395cacbaf6e0c9bef" } Frame { msec: 576 - hash: "3b88645092be28037fca4a6034f5b2f7" + hash: "9e5a57fabdc443e395cacbaf6e0c9bef" } Frame { msec: 592 - hash: "3b88645092be28037fca4a6034f5b2f7" + hash: "9e5a57fabdc443e395cacbaf6e0c9bef" } Frame { msec: 608 - hash: "3b88645092be28037fca4a6034f5b2f7" + hash: "9e5a57fabdc443e395cacbaf6e0c9bef" } Key { type: 6 @@ -182,27 +182,27 @@ VisualTest { } Frame { msec: 624 - hash: "3b88645092be28037fca4a6034f5b2f7" + hash: "9e5a57fabdc443e395cacbaf6e0c9bef" } Frame { msec: 640 - hash: "435ac0668ad4d0e196eb040d385053cb" + hash: "0e9c577fa86d9b3734da0d50040624e0" } Frame { msec: 656 - hash: "e9532fe1acc1c27a2119e6dde3e01637" + hash: "834cf83f0f8d613191cac775b5737664" } Frame { msec: 672 - hash: "9c757feaf5a8d1e88c659fca97e3b7b2" + hash: "495ea7650b2ae45f9afd7f9f6ecdd793" } Frame { msec: 688 - hash: "ccc7785a45a41615db01580835a4638e" + hash: "55c761ccee6543bb3b9564bb813df58e" } Frame { msec: 704 - hash: "11ad92022bcd5d3fbd28ffb9f51c69eb" + hash: "e29e5f86cb3b1fb5ec77fde696024812" } Key { type: 7 @@ -214,19 +214,19 @@ VisualTest { } Frame { msec: 720 - hash: "a8a94e1f95216864c368b8c3d0ae682b" + hash: "f24b7d5a8f5ab03460505d6203269d1b" } Frame { msec: 736 - hash: "d83e213d35e7fcff2580b4e197547f24" + hash: "893473965efe9e0540b197cbaa3f765d" } Frame { msec: 752 - hash: "9e5a57fabdc443e395cacbaf6e0c9bef" + hash: "a541b7be2f370f948048b2101b037ab7" } Frame { msec: 768 - hash: "9e5a57fabdc443e395cacbaf6e0c9bef" + hash: "a541b7be2f370f948048b2101b037ab7" } Key { type: 6 @@ -238,19 +238,19 @@ VisualTest { } Frame { msec: 784 - hash: "0e9c577fa86d9b3734da0d50040624e0" + hash: "da065f1e72883a45241630b96ee5b1f8" } Frame { msec: 800 - hash: "834cf83f0f8d613191cac775b5737664" + hash: "e97f78604c0c6d468c8dd225642e2ebd" } Frame { msec: 816 - hash: "495ea7650b2ae45f9afd7f9f6ecdd793" + hash: "7b9d4b14eedfa4ff10dd7e3747c4a7f5" } Frame { msec: 832 - hash: "55c761ccee6543bb3b9564bb813df58e" + hash: "6d55ba6287c720614854d36bb681a9f3" } Key { type: 7 @@ -262,27 +262,27 @@ VisualTest { } Frame { msec: 848 - hash: "e29e5f86cb3b1fb5ec77fde696024812" + hash: "3e7a44811f59bfb81de2f4f884a7af17" } Frame { msec: 864 - hash: "f24b7d5a8f5ab03460505d6203269d1b" + hash: "101113a7723b9d09275f66152b82142f" } Frame { msec: 880 - hash: "893473965efe9e0540b197cbaa3f765d" + hash: "0044e068522f912630868476f8bf49f8" } Frame { msec: 896 - hash: "a541b7be2f370f948048b2101b037ab7" + hash: "92065f9f170ee09abf67f0d0c7a1b6ba" } Frame { msec: 912 - hash: "a541b7be2f370f948048b2101b037ab7" + hash: "92065f9f170ee09abf67f0d0c7a1b6ba" } Frame { msec: 928 - hash: "a541b7be2f370f948048b2101b037ab7" + hash: "92065f9f170ee09abf67f0d0c7a1b6ba" } Key { type: 6 @@ -294,7 +294,7 @@ VisualTest { } Frame { msec: 944 - hash: "a541b7be2f370f948048b2101b037ab7" + hash: "92065f9f170ee09abf67f0d0c7a1b6ba" } Frame { msec: 960 @@ -302,7 +302,7 @@ VisualTest { } Frame { msec: 976 - hash: "e97f78604c0c6d468c8dd225642e2ebd" + hash: "e15814643bad6a71cb8c318ee5fd684a" } Key { type: 7 @@ -314,23 +314,23 @@ VisualTest { } Frame { msec: 992 - hash: "7b9d4b14eedfa4ff10dd7e3747c4a7f5" + hash: "9b07b6861a97d0871ed89369ff7449da" } Frame { msec: 1008 - hash: "6d55ba6287c720614854d36bb681a9f3" + hash: "7d95daf35c1823ea7187162b62010c57" } Frame { msec: 1024 - hash: "3e7a44811f59bfb81de2f4f884a7af17" + hash: "cc1e70fd1235d50ca291580bef1d6fc4" } Frame { msec: 1040 - hash: "101113a7723b9d09275f66152b82142f" + hash: "c8250f4cf69642e78523412b7b75501c" } Frame { msec: 1056 - hash: "0044e068522f912630868476f8bf49f8" + hash: "c57e421c803e8bfa1a85409cbb858829" } Key { type: 6 @@ -342,19 +342,19 @@ VisualTest { } Frame { msec: 1072 - hash: "4a50079d15b51758bf39b6d3fc51f337" + hash: "19b429a90d9877e62a7dee53ebf01fb2" } Frame { msec: 1088 - hash: "df659ebf6a5926943de92d6838127b9c" + hash: "7c810f174bed3826016272515df2d525" } Frame { msec: 1104 - hash: "0aa422c4af139023817465090f42f264" + hash: "9034cf480bda0d8b55aa6c43fc96b23d" } Frame { msec: 1120 - hash: "fb598a01e5cd9e3655f86a47ff7bda0d" + hash: "f62697a1f4e4df2869c14462a0d514fd" } Key { type: 7 @@ -366,19 +366,19 @@ VisualTest { } Frame { msec: 1136 - hash: "83a63dfcdbb27035d3e5208b066a2e1e" + hash: "c878f53b338d1ce332973193b0fa4b86" } Frame { msec: 1152 - hash: "c8250f4cf69642e78523412b7b75501c" + hash: "5d26f27061b319c391961dc30d985593" } Frame { msec: 1168 - hash: "c57e421c803e8bfa1a85409cbb858829" + hash: "e038ae877e8dddd3d99bf97475f59b3d" } Frame { msec: 1184 - hash: "f7611692216c0519b9188924e8a6b92e" + hash: "f44adc5e46d320c62095e1285ca8848b" } Key { type: 6 @@ -390,15 +390,15 @@ VisualTest { } Frame { msec: 1200 - hash: "0f9495c9f9f91c409f868959854824ed" + hash: "17f6b13e0556ac07dc527a9013a307a1" } Frame { msec: 1216 - hash: "d4a752aa1c4112a3b60f40468932945d" + hash: "70a1cc3b6dd3be4e30bb6763344fb980" } Frame { msec: 1232 - hash: "fbe2d7c160132f312911aabe4cad8bf5" + hash: "097c37d2243a27b8e800b5d4ec94b2e3" } Key { type: 7 @@ -410,27 +410,27 @@ VisualTest { } Frame { msec: 1248 - hash: "2d3c7dc0d0efac613a32860968d166ac" + hash: "15839227c002b1c71eb516f6653a7531" } Frame { msec: 1264 - hash: "fa0891d8c22dd26c1cb27d86864a8225" + hash: "f4a8103ef9010c651368d325fe9eee98" } Frame { msec: 1280 - hash: "5d26f27061b319c391961dc30d985593" + hash: "d158ec1c83719c58c1d0a2e4cc90998f" } Frame { msec: 1296 - hash: "e038ae877e8dddd3d99bf97475f59b3d" + hash: "6f66a44f5dc3fe150db2291b8cbc7327" } Frame { msec: 1312 - hash: "f44adc5e46d320c62095e1285ca8848b" + hash: "8a016eac5befb215a157f7fe5bc743de" } Frame { msec: 1328 - hash: "f44adc5e46d320c62095e1285ca8848b" + hash: "8a016eac5befb215a157f7fe5bc743de" } Key { type: 6 @@ -442,15 +442,15 @@ VisualTest { } Frame { msec: 1344 - hash: "17f6b13e0556ac07dc527a9013a307a1" + hash: "807129a4c578b1a5f0d3d84686eb0553" } Frame { msec: 1360 - hash: "70a1cc3b6dd3be4e30bb6763344fb980" + hash: "f9f2da990518048f0b050cc193567a20" } Frame { msec: 1376 - hash: "097c37d2243a27b8e800b5d4ec94b2e3" + hash: "762de7b1f4e56df6d7a245a23446884b" } Key { type: 7 @@ -462,23 +462,23 @@ VisualTest { } Frame { msec: 1392 - hash: "15839227c002b1c71eb516f6653a7531" + hash: "84ba7354badc3dca92974933c3610010" } Frame { msec: 1408 - hash: "f4a8103ef9010c651368d325fe9eee98" + hash: "36c3018870d74cff638d00acd03a0cf0" } Frame { msec: 1424 - hash: "d158ec1c83719c58c1d0a2e4cc90998f" + hash: "82b756a14eb0e802cd3e2d2d2a07f28e" } Frame { msec: 1440 - hash: "6f66a44f5dc3fe150db2291b8cbc7327" + hash: "74af1c12613130dc53533fe1178d5534" } Frame { msec: 1456 - hash: "8a016eac5befb215a157f7fe5bc743de" + hash: "c32818b0ba24f11295580d1ccffffdc0" } Key { type: 6 @@ -490,19 +490,19 @@ VisualTest { } Frame { msec: 1472 - hash: "807129a4c578b1a5f0d3d84686eb0553" + hash: "b858be109fac6852234bf1db161e515b" } Frame { msec: 1488 - hash: "f9f2da990518048f0b050cc193567a20" + hash: "9b3f8cffd3e79241d8a3b1f7d80790db" } Frame { msec: 1504 - hash: "762de7b1f4e56df6d7a245a23446884b" + hash: "840dc72aabc4a9b28bae641354676324" } Frame { msec: 1520 - hash: "84ba7354badc3dca92974933c3610010" + hash: "c60bfd5cc8b26a841035db29baba5dab" } Key { type: 7 @@ -514,23 +514,23 @@ VisualTest { } Frame { msec: 1536 - hash: "36c3018870d74cff638d00acd03a0cf0" + hash: "88d80dc8b0d968aa718ff464e507f53b" } Frame { msec: 1552 - hash: "82b756a14eb0e802cd3e2d2d2a07f28e" + hash: "f7ffc82d3448c415b4997401fb61b96b" } Frame { msec: 1568 - hash: "74af1c12613130dc53533fe1178d5534" + hash: "df8e9a09752fe2b2eff9184ba8e88ef1" } Frame { msec: 1584 - hash: "c32818b0ba24f11295580d1ccffffdc0" + hash: "97330e949a609f5f33832dd17e0c3716" } Frame { msec: 1600 - hash: "c32818b0ba24f11295580d1ccffffdc0" + hash: "97330e949a609f5f33832dd17e0c3716" } Key { type: 6 @@ -542,15 +542,15 @@ VisualTest { } Frame { msec: 1616 - hash: "b858be109fac6852234bf1db161e515b" + hash: "97330e949a609f5f33832dd17e0c3716" } Frame { msec: 1632 - hash: "9b3f8cffd3e79241d8a3b1f7d80790db" + hash: "97330e949a609f5f33832dd17e0c3716" } Frame { msec: 1648 - hash: "840dc72aabc4a9b28bae641354676324" + hash: "97330e949a609f5f33832dd17e0c3716" } Key { type: 7 @@ -562,19 +562,19 @@ VisualTest { } Frame { msec: 1664 - hash: "c60bfd5cc8b26a841035db29baba5dab" + hash: "97330e949a609f5f33832dd17e0c3716" } Frame { msec: 1680 - hash: "88d80dc8b0d968aa718ff464e507f53b" + hash: "97330e949a609f5f33832dd17e0c3716" } Frame { msec: 1696 - hash: "f7ffc82d3448c415b4997401fb61b96b" + hash: "97330e949a609f5f33832dd17e0c3716" } Frame { msec: 1712 - hash: "df8e9a09752fe2b2eff9184ba8e88ef1" + hash: "97330e949a609f5f33832dd17e0c3716" } Frame { msec: 1728 @@ -966,71 +966,71 @@ VisualTest { } Frame { msec: 2608 - hash: "85c0127315a489cfcf14ec7e16e43f4c" + hash: "68f3366932fed9156bf68dce6660b2a8" } Frame { msec: 2624 - hash: "65f1be6c38fa9e024671bfe612c585b4" + hash: "9f4be0b58c46035a11c5b80ec60618d5" } Frame { msec: 2640 - hash: "74b7b60a048d37c38f179d071e9d9730" + hash: "6d38a4eaa2a41c57599cca381957ec4c" } Frame { msec: 2656 - hash: "13c96d066af31d75647b0be21f1ae68d" + hash: "1061db26c9080067bf121eb1d164a3f3" } Frame { msec: 2672 - hash: "a1f880a95596f6c82385e51a4853327e" + hash: "c78d271711dc8f13fb48b41871249141" } Frame { msec: 2688 - hash: "8596123a6b0f234d90869d823448ff8e" + hash: "c5825611f6c429fddd8c20495507ea5f" } Frame { msec: 2704 - hash: "1ca65b63eea4034e3889f53c86ac95b7" + hash: "9888b608bcf80496a3fe8848be4e3629" } Frame { msec: 2720 - hash: "b847b515d89ad0394ef0fd4954158940" + hash: "9995d6ba039045d94903d5095b018ca8" } Frame { msec: 2736 - hash: "f73f7747115fdda2f0a13734a0dc9446" + hash: "f8ea705b4710b3ffb11c2fe08ccccda2" } Frame { msec: 2752 - hash: "5b31a1aca62cf654428e4d7fc25208b6" + hash: "7354c2fcabdede9fb1ee823ce098da3b" } Frame { msec: 2768 - hash: "f797d3c0364515138059967e17e185ed" + hash: "0d6beff960fa26771f09748356accedb" } Frame { msec: 2784 - hash: "dff0266adf50e30bc2a7674b001d19dc" + hash: "0720a8a1ed85344a1de6682b3aefd502" } Frame { msec: 2800 - hash: "610c72005c1aa83306fecc9ca34bf5a4" + hash: "0245488740e13dbfc836b587b2bdf917" } Frame { msec: 2816 - hash: "542587ab3dff0cfb3f724096871e925a" + hash: "25c4fcdd85017d18df7e83c15f1accbc" } Frame { msec: 2832 - hash: "fd79c9159a77b1be25d9cfde2e6cecb6" + hash: "51192ae0eae814f3dead9d949e2e4676" } Frame { msec: 2848 - hash: "e3d4bb451d6210e6006c54178d406068" + hash: "ddbe6b273882c6018c01e0a4480b1adb" } Frame { msec: 2864 - hash: "3dd3c57049bddb206c0204d7fbf673b0" + hash: "bb840a0677114b67d9b08589e8a8192b" } Frame { msec: 2880 @@ -1038,15 +1038,15 @@ VisualTest { } Frame { msec: 2896 - hash: "44008e30de01ecb1893a0fe4b06ec63a" + hash: "6ceadf740293537c7b9f2e2cfe8e6f1e" } Frame { msec: 2912 - hash: "c593c7e7edab1a034b96f778259b5b91" + hash: "f5c99d06e0b3055374ee4c6bf3e634f4" } Frame { msec: 2928 - hash: "9ac483cb720fef5783abd4e0072cf71e" + hash: "18fe01fadf4c5acbd369f4450db1efa6" } Frame { msec: 2944 @@ -1186,63 +1186,63 @@ VisualTest { } Frame { msec: 3232 - hash: "45bacd56ecaeefd9c80c7bd77e79cff0" + hash: "0e1f352c163ad8fe852c2e4857881d2f" } Frame { msec: 3248 - hash: "ad5239583e3924c98358e0ec7d12fd39" + hash: "3c3b44481a6c2330a4a03076e35055f4" } Frame { msec: 3264 - hash: "8e0fbae41165c553af4a49ed5691dfbb" + hash: "6ea3210a929774aea84a7beb4a784842" } Frame { msec: 3280 - hash: "c697930f45e23628c83a248de44472fb" + hash: "74dd747f9a64b19e5c5230c90ad3b642" } Frame { msec: 3296 - hash: "840e1f8ba5fe6e42d6dc41c1e42dc3dc" + hash: "c02be4ebefd19f4c5e864e8bbab7c13e" } Frame { msec: 3312 - hash: "e071cd254b69da678997eeb7ac0a13f8" + hash: "ce661af9085c833ec7d1fd66ebe67649" } Frame { msec: 3328 - hash: "27954d55c9772aa0ba237e7bdff75517" + hash: "4bf921874cfdc1b7d14e3a110b9e70a1" } Frame { msec: 3344 - hash: "5879feff61f02a9322b8620c84be4462" + hash: "f3e9cf8ac9e109e88d8c426fdcee28a9" } Frame { msec: 3360 - hash: "feba016bdcdc3f59b70000375a5b4242" + hash: "aa718a37f7ccf655d176adb799b5ddfb" } Frame { msec: 3376 - hash: "e57ae7048209884fb024481318c88080" + hash: "aa114a9676af508b4a106b21f7a2ed10" } Frame { msec: 3392 - hash: "93707dc8ec5e02adb691d0c6f3ff7772" + hash: "a5bbbaebb61b83384f5be82a9c3181ba" } Frame { msec: 3408 - hash: "ab2d8b822a4e2cd7c6a9cfa2e81d2113" + hash: "83deebf650b192de7c8a764d5379eeb4" } Frame { msec: 3424 - hash: "a9d0e39b30b16eafec85e08a75e2b50f" + hash: "5b433e1f5b97b39b6e86c837f0b91f2b" } Frame { msec: 3440 - hash: "8c94d16c8cde9b3d0ac8ccfb1374387d" + hash: "b5236be4e416f89a91eda7afbd75fc63" } Frame { msec: 3456 - hash: "7f4873f6c773b3d2d814bb1ea5c5dec6" + hash: "1713477f5484a1b35686f2f4bff27612" } Frame { msec: 3472 @@ -1254,63 +1254,63 @@ VisualTest { } Frame { msec: 3504 - hash: "042adc29907ca50187d4aad772a7500d" + hash: "7f64804cd07a0ae63d0e3a1b9f8f8a84" } Frame { msec: 3520 - hash: "90accd1b4f5bbe5cc59f3a73d697ea18" + hash: "9ae6bc952da97239bfee88633637aeb7" } Frame { msec: 3536 - hash: "3ce26e9c0b2ee1b4cb3dc19bbac92736" + hash: "ba34cd0d57d5d027ad6c2de102676399" } Frame { msec: 3552 - hash: "ca976ad1590e156e155cdba452dbc0ce" + hash: "c49632f9369aa901fcb702e76295c1e8" } Frame { msec: 3568 - hash: "b342477cedfb2a3839aa145703f33cb4" + hash: "3adab59e06a635a033564dfc8edc4877" } Frame { msec: 3584 - hash: "8fccdb3fbf637426b8b3df088a5a24a5" + hash: "67643cbfb3c9864b7447a9a8e316b251" } Frame { msec: 3600 - hash: "973c8d2d2496c5cc871aecc0b6be0bbb" + hash: "d04d288cbf89e1ad3bbf25ffebd7a382" } Frame { msec: 3616 - hash: "6af9574467c7b565450dc6533dddb0f2" + hash: "e6c4d34b9b3de464ec0dcf8719b86313" } Frame { msec: 3632 - hash: "ced3d8a93bf564c0ebec837f1655c202" + hash: "f73462d0fe19cbbd771f9f78d7bc4384" } Frame { msec: 3648 - hash: "0a38fe8ac9024b4a30b8efbcf155bbd8" + hash: "6369f075a492240aee36eae8dcb2ace5" } Frame { msec: 3664 - hash: "2421dc73fe95e8abb246ae894ac255b2" + hash: "1e9424a3b93833f8ae855c5f7877679a" } Frame { msec: 3680 - hash: "98789298fcc85a0b3307036c800d80af" + hash: "da274c1ae57d217ef4515326d32646b4" } Frame { msec: 3696 - hash: "6361b512cfd9aa5f97529089ad7d902c" + hash: "1cbe684ba95e6ef635873f746e942f3d" } Frame { msec: 3712 - hash: "5f26400f45140d634ac49ae5ce6bc2cf" + hash: "228e13c1d3dea6e666637de7cedd6dd4" } Frame { msec: 3728 - hash: "49586dcf6a4c7a80563e9cc67b16a520" + hash: "a3f8fec49fb88652e9339b621ea8b972" } Mouse { type: 2 @@ -1322,7 +1322,7 @@ VisualTest { } Frame { msec: 3744 - hash: "fa8827f2a5eefaa9f740e36e4eb05083" + hash: "7c3eb16bf4f66d2b9889c9d80aaae8b2" } Mouse { type: 5 @@ -1334,7 +1334,7 @@ VisualTest { } Frame { msec: 3760 - hash: "5f2e33f8b436686840a124ba71f7d203" + hash: "1825d33eb9ae94a63d334d93e07ce9af" } Mouse { type: 5 @@ -1346,7 +1346,7 @@ VisualTest { } Frame { msec: 3776 - hash: "b0093a1f538381e79f43c91192437be5" + hash: "306652a5a179cf23ee87c10571814f53" } Mouse { type: 5 @@ -1358,7 +1358,7 @@ VisualTest { } Frame { msec: 3792 - hash: "9a8e645817c214a0353beadc0bc2e3f8" + hash: "3d3ba7cd968a1f91f7534cabd7cc034b" } Mouse { type: 5 @@ -1370,7 +1370,7 @@ VisualTest { } Frame { msec: 3808 - hash: "3f059fefcb7908e6f89a4b245bd0c948" + hash: "862f70151938a5d27db37a9f5dd53faa" } Mouse { type: 5 @@ -1382,7 +1382,7 @@ VisualTest { } Frame { msec: 3824 - hash: "48ccbb037ebe01dc9c73fafa54aa6175" + hash: "92b9283fa8b5642ce9bd14d875a12b75" } Mouse { type: 5 @@ -1406,7 +1406,7 @@ VisualTest { } Frame { msec: 3856 - hash: "3398c59636fc02358fc0b22d7bc2afd3" + hash: "58e61d0a4f397c5a2b137d6a6e85d99b" } Mouse { type: 5 @@ -1418,7 +1418,7 @@ VisualTest { } Frame { msec: 3872 - hash: "86ebc9911fc2da29a1960ae3999e4329" + hash: "6cdd764ee39789307e5e313bfbbb7765" } Mouse { type: 5 @@ -1438,83 +1438,83 @@ VisualTest { } Frame { msec: 3888 - hash: "7e910c843f531af6d08a0c7ea890c823" + hash: "a88656d49e4636b18c4f6f4a0ab943d6" } Frame { msec: 3904 - hash: "7e92be7beeba33541e16305d5cb7b3b6" + hash: "f1ec9a65d5f8d2020db1b70bcd419417" } Frame { msec: 3920 - hash: "1e7caa1bb4627bea028cdd2ef2260d9f" + hash: "ca7d3d7d26445d13acd7fe4a2c5d1d4d" } Frame { msec: 3936 - hash: "a7d77ec36935d8d8c8a6120d373d714c" + hash: "90016f51541a15ba4b6265f6843a2998" } Frame { msec: 3952 - hash: "770e16a5c7bf17522445bdae41d170df" + hash: "bdb992552a5c5707ddb372631f72e6a3" } Frame { msec: 3968 - hash: "d5c93bb61aeef777bb91dd504e91ecf6" + hash: "af69ed47f0f40648d55af10c87866805" } Frame { msec: 3984 - hash: "2247494cb67e7f0cade508b6ef46cb3e" + hash: "33e77562bdf839ca1e969b918d90a07b" } Frame { msec: 4000 - hash: "61a480c3a29f37b4383b430b02eb5dc1" + hash: "2001b5ca444808a79c49adc9d03c960e" } Frame { msec: 4016 - hash: "f741ede20b0ad51f81c7aba44705a08e" + hash: "e4186283e5fe0c1efb29eca6f59e9079" } Frame { msec: 4032 - hash: "73bb52725e3906ac3074371936e9f3f3" + hash: "dab82d0bbba66df3297712b42f74f25a" } Frame { msec: 4048 - hash: "a915081e3c6ca9397567cb3df2aed517" + hash: "b180ad3acdfd736276ef4d1de040bb55" } Frame { msec: 4064 - hash: "79b514577bcc36db6de4db2e8b284a4c" + hash: "577445b0e4d6f8079830c2b87ce5829d" } Frame { msec: 4080 - hash: "5412571baa69b8e0c3b4daf52796482a" + hash: "45fffe51376abef4cb28842b392ab0b7" } Frame { msec: 4096 - hash: "7f739333fdc9c3457461e7fcf49bf650" + hash: "fc14e3b2d16e1f078d223876ef71c81e" } Frame { msec: 4112 - hash: "ed9a9fdd4bea6e9f7f7078934337b4a6" + hash: "4ef2b65280a00a6a4e66185f41479aef" } Frame { msec: 4128 - hash: "4fbc687f1a5b4364a90441134162c817" + hash: "131181ce7ff2f4d4e69823fcb7a20755" } Frame { msec: 4144 - hash: "7c91ad050f31e30b7f16b99dd1ed19df" + hash: "8e6db058e96dad9c4963b881083ab9bf" } Frame { msec: 4160 - hash: "44777e9a08d5f112b922272227b22558" + hash: "e2d407b6dff40625790d4fd9e599b374" } Frame { msec: 4176 - hash: "c4f7523d0a214e188c95d7cbd4455a9d" + hash: "631fe708fdcb1e4f4ea89b10da5db623" } Frame { msec: 4192 - hash: "7703b85f0bda71fa8ff84a557b015458" + hash: "e11831f37a3a1da78cbdc7604ddccd68" } Mouse { type: 2 @@ -1526,7 +1526,7 @@ VisualTest { } Frame { msec: 4208 - hash: "0bd445389e69d1d758a9b17eee69d584" + hash: "c2dccc4e890b2302edd413dcdb87b50b" } Mouse { type: 5 @@ -1538,7 +1538,7 @@ VisualTest { } Frame { msec: 4224 - hash: "13bfb19a05b5aef65f7f70b2c0b01424" + hash: "b4f6a6650dd779c8ad8696c23f44411a" } Mouse { type: 5 @@ -1550,7 +1550,7 @@ VisualTest { } Frame { msec: 4240 - hash: "9d6a81d6f7df8aa93c9421fa3cdc3a7d" + hash: "ad913e53e63c030ffdf4560766722760" } Mouse { type: 5 @@ -1570,7 +1570,7 @@ VisualTest { } Frame { msec: 4256 - hash: "4d88acb157fdeb0c608b6c9d75e999e8" + hash: "ef31f8a4d5bde5a2e308d19ee6d5e759" } Mouse { type: 5 @@ -1582,7 +1582,7 @@ VisualTest { } Frame { msec: 4272 - hash: "fe506e31923e1feb2d2b3c105444f61f" + hash: "3ba07527f66e8bea5a8fb7647b0b4f3f" } Mouse { type: 5 @@ -1594,7 +1594,7 @@ VisualTest { } Frame { msec: 4288 - hash: "72c0ccbbf296742f67139bd9a4abcf6b" + hash: "70e5fe656f5fd843383964825690b678" } Mouse { type: 5 @@ -1614,7 +1614,7 @@ VisualTest { } Frame { msec: 4304 - hash: "75b083e391afb3cdb8e4bcd885f17966" + hash: "b7d8738be4cd6caa63dbecdb0f810a2f" } Mouse { type: 5 @@ -1626,7 +1626,7 @@ VisualTest { } Frame { msec: 4320 - hash: "2babcf0e4d434120e0a7eb7d8716baa7" + hash: "d6312191f9d7bbddc07f9253d8a93469" } Mouse { type: 5 @@ -1638,7 +1638,7 @@ VisualTest { } Frame { msec: 4336 - hash: "676e6a7587781146f58f82ca1ceac2b3" + hash: "b182da64886cf4f444296e5fde26701e" } Mouse { type: 5 @@ -1650,7 +1650,7 @@ VisualTest { } Frame { msec: 4352 - hash: "58ecd6234c3c0f7ceec942098e3ae0fc" + hash: "ebefef14b6fb990e0c6900884528bbd3" } Mouse { type: 5 @@ -1662,7 +1662,7 @@ VisualTest { } Frame { msec: 4368 - hash: "25a8af71ba1cf4581682cbec3b9baf8a" + hash: "9a3451ed091b1bb6b975a9c5506b1ea4" } Mouse { type: 5 @@ -1674,7 +1674,7 @@ VisualTest { } Frame { msec: 4384 - hash: "11c305643f2ed535a6dc0a7a54caf17c" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Mouse { type: 5 @@ -1686,7 +1686,7 @@ VisualTest { } Frame { msec: 4400 - hash: "29b33349f90286b2c078ae8d5896a338" + hash: "eaaf9ea1d7fcf4a2a9dd58b1b5bb3cae" } Mouse { type: 5 @@ -1698,7 +1698,7 @@ VisualTest { } Frame { msec: 4416 - hash: "af917864d02b49bef4190ee1fca607dc" + hash: "7ca8e3d76cf913d85f84f0b96acde829" } Mouse { type: 5 @@ -1710,7 +1710,7 @@ VisualTest { } Frame { msec: 4432 - hash: "7b1af6cddd2f78615354f747dfd016b9" + hash: "7cfef56b24a552c6d4ecb3d0b88a1d08" } Mouse { type: 5 @@ -1730,7 +1730,7 @@ VisualTest { } Frame { msec: 4448 - hash: "84f1757af8c26b4f00298090e09f7f68" + hash: "d032b257259810b4fe514c63ca5c9e4b" } Mouse { type: 5 @@ -1742,7 +1742,7 @@ VisualTest { } Frame { msec: 4464 - hash: "fd214ddbd1f60dc733994ba7a2048951" + hash: "568f6a57e6f1644b0dc245d03a1d7b85" } Mouse { type: 5 @@ -1754,83 +1754,83 @@ VisualTest { } Frame { msec: 4480 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4496 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4512 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4528 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4544 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4560 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4576 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4592 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4608 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4624 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4640 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4656 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4672 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4688 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4704 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4720 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4736 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4752 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4768 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4784 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4800 @@ -1838,15 +1838,15 @@ VisualTest { } Frame { msec: 4816 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4832 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Frame { msec: 4848 - hash: "01f209a3b5e9adaa32ad55c7d1f1d4c7" + hash: "5cb4cf2c527d821db2a5072dd3702653" } Mouse { type: 5 @@ -1866,7 +1866,7 @@ VisualTest { } Frame { msec: 4864 - hash: "1dc57bc129f3a6d5287ec0fa2a99d62e" + hash: "d48ecbd0661e08b2117fe2fd96ffeb2c" } Mouse { type: 5 @@ -1878,7 +1878,7 @@ VisualTest { } Frame { msec: 4880 - hash: "7b1af6cddd2f78615354f747dfd016b9" + hash: "7cfef56b24a552c6d4ecb3d0b88a1d08" } Mouse { type: 5 @@ -1890,7 +1890,7 @@ VisualTest { } Frame { msec: 4896 - hash: "a890208c702b9fde41584a33b3038940" + hash: "5b12e9d17d9d464b055601db9cf0da44" } Mouse { type: 5 @@ -1902,7 +1902,7 @@ VisualTest { } Frame { msec: 4912 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "25333e1f0cc9cfc664fd7369af544c06" } Mouse { type: 5 @@ -1914,39 +1914,39 @@ VisualTest { } Frame { msec: 4928 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 4944 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 4960 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 4976 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 4992 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 5008 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 5024 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 5040 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 5056 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Mouse { type: 3 @@ -1958,175 +1958,175 @@ VisualTest { } Frame { msec: 5072 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 5088 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 5104 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 5120 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 5136 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 5152 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 5168 - hash: "cdc2d0868771429226c74e77676f55f1" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 5184 - hash: "768d6d504470ce841e51022dd514edc5" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 5200 - hash: "768d6d504470ce841e51022dd514edc5" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 5216 - hash: "768d6d504470ce841e51022dd514edc5" + hash: "04290d8d62436c8a812f886e0a56ec1b" } Frame { msec: 5232 - hash: "768d6d504470ce841e51022dd514edc5" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5248 - hash: "768d6d504470ce841e51022dd514edc5" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5264 - hash: "768d6d504470ce841e51022dd514edc5" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5280 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5296 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5312 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5328 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5344 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5360 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5376 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5392 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5408 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5424 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5440 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5456 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5472 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5488 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5504 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5520 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5536 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5552 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5568 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5584 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5600 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5616 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5632 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5648 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5664 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5680 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5696 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5712 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5728 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5744 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5760 @@ -2134,94 +2134,94 @@ VisualTest { } Frame { msec: 5776 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5792 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5808 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5824 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5840 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5856 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5872 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5888 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5904 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5920 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5936 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5952 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5968 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 5984 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 6000 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 6016 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 6032 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 6048 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 6064 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 6080 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 6096 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 6112 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } Frame { msec: 6128 - hash: "6df3f8000a0d390b89d41c6ece6ea221" + hash: "dbd87bf02d698b7f053d307ef0c98452" } } -- cgit v0.12 From b628a6dc1373fcfbc71a7668d39111c699396674 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 4 Nov 2010 15:18:08 +1000 Subject: Document list type operations Task-number: QTBUG-14645 --- doc/src/declarative/basictypes.qdoc | 85 ++++++++++++++++++++++++++++++++++--- doc/src/declarative/extending.qdoc | 9 +++- 2 files changed, 87 insertions(+), 7 deletions(-) diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc index 6abe96f..8ab06ab 100644 --- a/doc/src/declarative/basictypes.qdoc +++ b/doc/src/declarative/basictypes.qdoc @@ -355,9 +355,11 @@ \brief A list of objects. - A list of objects. While not technically a basic type, QML also - supports lists of object types. When used from QML, the engine - automatically appends each value to the list. + A list type contains a list of objects. While not technically + a basic type, QML supports lists of object types. When used + from QML, the engine automatically appends each value to the list. + Items in the list can be accessed by index using the usual + \c listName[index] syntax. For example, the \l Item class contains a list property named children that can be used like this: @@ -366,14 +368,87 @@ Item { children: [ Item { id: child1 }, - Rectangle { id: child2 }, + Rectangle { id: child2; width: 200 }, Text { id: child3 } ] + + Component.onCompleted: { + console.log("Width of child rectangle:", children[1].width) + } } \endqml - \c child1, \c child2 and \c child3 will all be added to the children list + \c child1, \c child2 and \c child3 will be added to the children list in the order in which they appear. + List \l {Adding new properties}{properties} can be created as a + \c variant type, or as a \c list type, where \c Type is the + type of the object in the list: + + \qml + Item { + property variant values: [ 10, 20, 'abc', 'xyz' ] + + property list rects: [ + Rectangle { width: 100; height: 100}, + Rectangle { width: 200; height: 200} + ] + } + \endqml + + A \c variant list can contain values of any of the \l {QML Basic Types}{basic QML types} + such as numbers, strings, etc. while a \c list list can only contain values + that match (or are derived from) the specified \c Type. + + A list property can be cleared by setting it to an empty list: + + \qml + Item { + children: [] + } + \endqml + + A list property cannot be modified in any other way. Items cannot be dynamically added to + or removed from the list through JavaScript operations; any \c push() operations on the + list only modify a \e copy of the list and not the actual list. (These current limitations + are due to restrictions on \l {Property Binding} where lists are involved.) + + To create a modifiable list, create an array object from within a \c .js JavaScript file, + or implement a custom list element in C++. Here is a QML element that modifies the list in a + JavaScript file: + + \table + \row + \o + \qml + // QML + import "script.js" as Script + + Item { + Component.onCompleted: { + Script.addItem('abc') + console.log("Added:", Script.getList()[0]) + } + } + \endqml + + \o + \code + // script.js + var myArray = new Array() + + function getList() { + return myArray + } + + function addItem(item) { + myArray.push(item) + } + \endcode + \endtable + + However, note that a JavaScript list should not be used as a QML \c property value, + as the property is not updated when the list changes. + \sa {QML Basic Types} */ diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 18887c7..5c1b977 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -647,7 +647,8 @@ language. \section1 Adding new properties -New properties can be added to an existing type. These new properties are +New properties can be added to an existing type using the \c property keyword. +These new properties are available for use within QML, and also appear as regular Qt properties on the C++ object, accessible through the regular property access mechanisms. @@ -679,8 +680,12 @@ like this: property list listOfItemsProperty \endcode +Custom types must be registered with qmlRegisterType() to be usable as a property +type. Also note that list properties cannot be modified like ordinary JavaScript +arrays; see the \l {list}{list type documentation} for details. + QML supports two methods for adding a new property to a type: a new property -definition, and a property alias. +definition, and a property alias. These are shown below. \section2 Property definitions -- cgit v0.12 From b5588ded342ed9dbc9f00fc8a4091e447880eccc Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 4 Nov 2010 15:18:52 +1000 Subject: Largely rewrite the Using QML in C++ Applications documentation. It now has an overview of different approaches to QML/C++ integration and demonstrates how to pass data between QML and C++ through properties/functions/signals. The part in the old docs that focused on QDeclarativeContext has been merged into the QDeclarativeContext class docs (although most of the info was largely covered in there already) and the part that covered Network Components has been moved to the QDeclarativeComponent class docs. The custom enum types example previously in extending-tutorial.qdoc has been moved to these new docs. Task-number: QTBUG-14923 --- doc/src/declarative/extending-tutorial.qdoc | 20 +- doc/src/declarative/qtbinding.qdoc | 631 ++++++++++++++++----- .../qtbinding/context-advanced/MyItem.qml | 46 ++ .../qtbinding/context-advanced/applicationdata.h | 52 ++ .../qtbinding/context-advanced/connections.qml | 52 ++ .../context-advanced/context-advanced.pro | 3 + .../qtbinding/context-advanced/main.cpp | 60 ++ .../declarative/qtbinding/context/MyItem.qml | 45 ++ .../declarative/qtbinding/context/context.pro | 2 + .../declarative/qtbinding/context/main.cpp | 56 ++ .../contextproperties/contextproperties.pro | 2 - .../qtbinding/contextproperties/main.cpp | 78 --- .../qtbinding/contextproperties/main.qml | 55 -- .../qtbinding/custompalette/custompalette.h | 79 --- .../qtbinding/custompalette/custompalette.pro | 3 - .../declarative/qtbinding/custompalette/main.cpp | 61 -- .../declarative/qtbinding/custompalette/main.qml | 62 -- .../snippets/declarative/qtbinding/enums/enums.pro | 3 + .../declarative/qtbinding/enums/imageviewer.h | 68 +++ .../snippets/declarative/qtbinding/enums/main.cpp | 73 +++ .../declarative/qtbinding/enums/standalone.qml | 49 ++ .../declarative/qtbinding/functions-cpp/MyItem.qml | 55 ++ .../qtbinding/functions-cpp/functions-qml.pro | 3 + .../declarative/qtbinding/functions-cpp/main.cpp | 59 ++ .../declarative/qtbinding/functions-cpp/myclass.h | 57 ++ .../declarative/qtbinding/functions-qml/MyItem.qml | 50 ++ .../qtbinding/functions-qml/functions-qml.pro | 2 + .../declarative/qtbinding/functions-qml/main.cpp | 63 ++ .../declarative/qtbinding/loading/MyItem.qml | 56 ++ .../declarative/qtbinding/loading/loading.pro | 2 + .../declarative/qtbinding/loading/main.cpp | 90 +++ .../qtbinding/newelements/imageviewer.h | 56 ++ .../declarative/qtbinding/newelements/main.cpp | 62 ++ .../qtbinding/newelements/newelements.pro | 3 + .../qtbinding/newelements/standalone.qml | 44 ++ .../qtbinding/properties-cpp/MyItem.qml | 54 ++ .../qtbinding/properties-cpp/applicationdata.h | 71 +++ .../declarative/qtbinding/properties-cpp/main.cpp | 58 ++ .../qtbinding/properties-cpp/properties-cpp.pro | 3 + .../qtbinding/properties-qml/MyItem.qml | 47 ++ .../declarative/qtbinding/properties-qml/main.cpp | 61 ++ .../qtbinding/properties-qml/properties-qml.pro | 2 + .../declarative/qtbinding/resources/main.qml | 5 +- .../declarative/qtbinding/signals-cpp/MyItem.qml | 50 ++ .../qtbinding/signals-cpp/imageviewer.h | 64 +++ .../declarative/qtbinding/signals-cpp/main.cpp | 81 +++ .../qtbinding/signals-cpp/signals-cpp.pro | 3 + .../qtbinding/signals-cpp/standalone.qml | 48 ++ .../declarative/qtbinding/signals-qml/MyItem.qml | 55 ++ .../declarative/qtbinding/signals-qml/main.cpp | 59 ++ .../declarative/qtbinding/signals-qml/myclass.h | 51 ++ .../qtbinding/signals-qml/signals-qml.pro | 3 + .../declarative/qtbinding/stopwatch/main.cpp | 62 -- .../declarative/qtbinding/stopwatch/main.qml | 58 -- .../declarative/qtbinding/stopwatch/stopwatch.cpp | 62 -- .../declarative/qtbinding/stopwatch/stopwatch.h | 61 -- .../declarative/qtbinding/stopwatch/stopwatch.pro | 3 - src/declarative/qml/qdeclarativecomponent.cpp | 37 ++ src/declarative/qml/qdeclarativecontext.cpp | 21 +- tests/auto/declarative/examples/tst_examples.cpp | 1 + 60 files changed, 2363 insertions(+), 759 deletions(-) create mode 100644 doc/src/snippets/declarative/qtbinding/context-advanced/MyItem.qml create mode 100644 doc/src/snippets/declarative/qtbinding/context-advanced/applicationdata.h create mode 100644 doc/src/snippets/declarative/qtbinding/context-advanced/connections.qml create mode 100644 doc/src/snippets/declarative/qtbinding/context-advanced/context-advanced.pro create mode 100644 doc/src/snippets/declarative/qtbinding/context-advanced/main.cpp create mode 100644 doc/src/snippets/declarative/qtbinding/context/MyItem.qml create mode 100644 doc/src/snippets/declarative/qtbinding/context/context.pro create mode 100644 doc/src/snippets/declarative/qtbinding/context/main.cpp delete mode 100644 doc/src/snippets/declarative/qtbinding/contextproperties/contextproperties.pro delete mode 100644 doc/src/snippets/declarative/qtbinding/contextproperties/main.cpp delete mode 100644 doc/src/snippets/declarative/qtbinding/contextproperties/main.qml delete mode 100644 doc/src/snippets/declarative/qtbinding/custompalette/custompalette.h delete mode 100644 doc/src/snippets/declarative/qtbinding/custompalette/custompalette.pro delete mode 100644 doc/src/snippets/declarative/qtbinding/custompalette/main.cpp delete mode 100644 doc/src/snippets/declarative/qtbinding/custompalette/main.qml create mode 100644 doc/src/snippets/declarative/qtbinding/enums/enums.pro create mode 100644 doc/src/snippets/declarative/qtbinding/enums/imageviewer.h create mode 100644 doc/src/snippets/declarative/qtbinding/enums/main.cpp create mode 100644 doc/src/snippets/declarative/qtbinding/enums/standalone.qml create mode 100644 doc/src/snippets/declarative/qtbinding/functions-cpp/MyItem.qml create mode 100644 doc/src/snippets/declarative/qtbinding/functions-cpp/functions-qml.pro create mode 100644 doc/src/snippets/declarative/qtbinding/functions-cpp/main.cpp create mode 100644 doc/src/snippets/declarative/qtbinding/functions-cpp/myclass.h create mode 100644 doc/src/snippets/declarative/qtbinding/functions-qml/MyItem.qml create mode 100644 doc/src/snippets/declarative/qtbinding/functions-qml/functions-qml.pro create mode 100644 doc/src/snippets/declarative/qtbinding/functions-qml/main.cpp create mode 100644 doc/src/snippets/declarative/qtbinding/loading/MyItem.qml create mode 100644 doc/src/snippets/declarative/qtbinding/loading/loading.pro create mode 100644 doc/src/snippets/declarative/qtbinding/loading/main.cpp create mode 100644 doc/src/snippets/declarative/qtbinding/newelements/imageviewer.h create mode 100644 doc/src/snippets/declarative/qtbinding/newelements/main.cpp create mode 100644 doc/src/snippets/declarative/qtbinding/newelements/newelements.pro create mode 100644 doc/src/snippets/declarative/qtbinding/newelements/standalone.qml create mode 100644 doc/src/snippets/declarative/qtbinding/properties-cpp/MyItem.qml create mode 100644 doc/src/snippets/declarative/qtbinding/properties-cpp/applicationdata.h create mode 100644 doc/src/snippets/declarative/qtbinding/properties-cpp/main.cpp create mode 100644 doc/src/snippets/declarative/qtbinding/properties-cpp/properties-cpp.pro create mode 100644 doc/src/snippets/declarative/qtbinding/properties-qml/MyItem.qml create mode 100644 doc/src/snippets/declarative/qtbinding/properties-qml/main.cpp create mode 100644 doc/src/snippets/declarative/qtbinding/properties-qml/properties-qml.pro create mode 100644 doc/src/snippets/declarative/qtbinding/signals-cpp/MyItem.qml create mode 100644 doc/src/snippets/declarative/qtbinding/signals-cpp/imageviewer.h create mode 100644 doc/src/snippets/declarative/qtbinding/signals-cpp/main.cpp create mode 100644 doc/src/snippets/declarative/qtbinding/signals-cpp/signals-cpp.pro create mode 100644 doc/src/snippets/declarative/qtbinding/signals-cpp/standalone.qml create mode 100644 doc/src/snippets/declarative/qtbinding/signals-qml/MyItem.qml create mode 100644 doc/src/snippets/declarative/qtbinding/signals-qml/main.cpp create mode 100644 doc/src/snippets/declarative/qtbinding/signals-qml/myclass.h create mode 100644 doc/src/snippets/declarative/qtbinding/signals-qml/signals-qml.pro delete mode 100644 doc/src/snippets/declarative/qtbinding/stopwatch/main.cpp delete mode 100644 doc/src/snippets/declarative/qtbinding/stopwatch/main.qml delete mode 100644 doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.cpp delete mode 100644 doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.h delete mode 100644 doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.pro diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc index 3b2fe3b..2bfe62e 100644 --- a/doc/src/declarative/extending-tutorial.qdoc +++ b/doc/src/declarative/extending-tutorial.qdoc @@ -260,32 +260,28 @@ custom QML types may see unexpected behavior if bindings are not implemented. The \c PieChart type currently has a string-type property and a color-type property. It could have many other types of properties. For example, it could have an -enum-type property to store a display mode for each chart: +int-type property to store an identifier for each chart: \code // C++ class PieChart : public QDeclarativeItem { - Q_ENUMS(DisplayMode) - Q_PROPERTY(DisplayMode displayMode READ displayMode WRITE setDisplayMode) + Q_PROPERTY(int chartId READ chartId WRITE setChartId NOTIFY chartIdChanged) ... public: - enum DisplayMode { - MultiLevel, - Exploded, - ThreeDimensional - }; - - void setDisplayMode(DisplayMode mode); - DisplayMode displayMode() const; + void setChartId(int chartId); + int chartId() const; ... + + signals: + void chartIdChanged(); }; // QML PieChart { ... - displayMode: PieChart.Exploded + chartId: 100 } \endcode diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index 58d53de..8a969eb 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -30,126 +30,389 @@ \target qtbinding \title Using QML in C++ Applications -\tableofcontents +QML is designed to be easily extensible from C++. The classes in the +QtDeclarative module allow QML components to be loaded and manipulated from C++, and through +Qt's \l{The Meta-Object System}{meta-object system}, QML and C++ objects can easily +communicate through Qt signals and slots. In addition, QML plugins can be written to create +reusable QML components for distribution. -The QML API is split into three main classes - QDeclarativeEngine, QDeclarativeComponent and QDeclarativeContext. -QDeclarativeEngine provides the environment in which QML is run, QDeclarativeComponent encapsulates -\l {QML Documents}, and QDeclarativeContext allows applications to expose data to QML component instances. +You may want to mix QML and C++ for a number of reasons. For example: -QML also includes a convenience API, QDeclarativeView, for applications that simply want to embed QML -components into a new QGraphicsView. QDeclarativeView covers up many of the details discussed below. -While QDeclarativeView is mainly intended for rapid prototyping it can have uses in production applications. +\list +\o To use functionality defined in a C++ source (for example, when using a C++ Qt-based data model, or +calling functions in a third-party C++ library) +\o To access functionality in the QtDeclarative module (for example, to dynamically generate +images using QDeclarativeImageProvider) +\o To write your own QML elements (whether for your applications, or for distribution to others) +\endlist + +To use the QtDeclarative module, you must include and link to the module appropriately, as shown on +the \l {QtDeclarative}{module index page}. The \l {Qt Declarative UI Runtime} documentation +shows how to build a basic C++ application that uses this module. + + +\section1 Core module classes -If you are looking at retrofitting an existing Qt application with QML, -read \l{Integrating QML with existing Qt UI code}. -\section1 Basic Usage +The QtDeclarative module provides a set of C++ APIs for extending your QML applications from C++ and +embedding QML into C++ applications. There are several core classes in the QtDeclarative module +that provide the essential capabilities for doing this. These are: -Every application requires at least one QDeclarativeEngine. A QDeclarativeEngine allows the configuration of -global settings that apply to all the QML component instances - such as the QNetworkAccessManager -that is used for network communications, and the path used for persistent storage. -Multiple QDeclarativeEngine's are only needed if the application requires these settings to differ -between QML component instances. +\list +\o QDeclarativeEngine: A QML engine provides the environment for executing QML code. Every +application requires at least one engine instance. +\o QDeclarativeComponent: A component encapsulates a \l{QML Documents}{QML document}. +\o QDeclarativeContext: A context allows an application to expose data to the QML components +created by an engine. +\endlist -\l {QML Documents} are loaded using the QDeclarativeComponent class. Each QDeclarativeComponent instance -represents a single QML document. A QDeclarativeComponent can be passed a document URL, or raw text -representing the content of the document. The document URL can be a local filesystem URL, or -any network URL supported by QNetworkAccessManager. +A QDeclarativeEngine allows the configuration of global settings that apply to all of its QML +component instances: for example, the QNetworkAccessManager to be used for network communications, +and the file path to be used for persistent storage. -QML component instances can then be created by calling the QDeclarativeComponent::create() method. Here's -an example of loading a QML document, and creating an object from it. +QDeclarativeComponent is used to load QML documents. Each QDeclarativeComponent instance represents +a single document. A component can be created from the URL or file path of a QML document, or the raw +QML code of the document. Component instances are instatiated through the +QDeclarativeComponent::create() method, like this: \code - QDeclarativeEngine *engine = new QDeclarativeEngine(parent); - QDeclarativeComponent component(engine, QUrl::fromLocalFile("main.qml")); - QObject *myObject = component.create(); +QDeclarativeEngine engine; +QDeclarativeComponent component(&engine, QUrl::fromLocalFile("MyRectangle.qml")); +QObject *rectangleInstance = component.create(); + +// ... +delete rectangleInstance; \endcode -\section1 Exposing Data +QML documents can also be loaded using QDeclarativeView. This class provides a convenient +QWidget-based view for embedding QML components into QGraphicsView-based applications. (For other +methods of integrating QML into QWidget-based applications, see \l {Integrating QML with existing Qt +UI code}.) + + +\section1 Approaches to using QML with C++ + +There are a number of ways to extend your QML application through C++. For example, you could: + +\list +\o Load a QML component and manipulate it (or its children) from C++ +\o Embed a C++ object and its properties directly into a QML component (for example, to make a +particular C++ object callable from QML, or to replace a dummy list model data with a real data set) +\o Define new QML elements (through QObject-based C++ classes) and create them directly from your +QML code +\endlist + +These methods are shown below. Naturally these approaches are not exclusive; you can mix any of +these methods throughout your application as appropriate. + + +\section2 Loading QML components from C++ + +A QML document can be loaded with QDeclarativeComponent or QDeclarativeView. QDeclarativeComponent +loads a QML component as a C++ object; QDeclarativeView also does this, +but additionally loads the QML component directly into a QGraphicsView. It is convenient for loading +a displayable QML component into a QWidget-based application. + +For example, suppose there is a \c MyItem.qml file that looks like this: + +\snippet doc/src/snippets/declarative/qtbinding/loading/MyItem.qml start +\snippet doc/src/snippets/declarative/qtbinding/loading/MyItem.qml end + +This QML document can be loaded with QDeclarativeComponent or QDeclarativeView with the following +C++ code. Using a QDeclarativeComponent requires calling QDeclarativeComponent::create() to create +a new instance of the component, while a QDeclarativeView automatically creates an instance of the +component, which is accessible via QDeclarativeView::rootObject(): + +\table +\row +\o +\snippet doc/src/snippets/declarative/qtbinding/loading/main.cpp QDeclarativeComponent-a +\dots 0 +\snippet doc/src/snippets/declarative/qtbinding/loading/main.cpp QDeclarativeComponent-b +\o +\snippet doc/src/snippets/declarative/qtbinding/loading/main.cpp QDeclarativeView +\endtable + +This \c object is the instance of the \c MyItem.qml component that has been created. You can now +modify the item's properties using QObject::setProperty() or QDeclarativeProperty: + +\snippet doc/src/snippets/declarative/qtbinding/loading/main.cpp properties + +Alternatively, you can cast the object to its actual type and call functions with compile-time +safety. In this case the base object of \c MyItem.qml is an \l Item, which is defined by the +QDeclarativeItem class: + +\snippet doc/src/snippets/declarative/qtbinding/loading/main.cpp cast + +You can also connect to any signals or call functions defined in the component using +QMetaObject::invokeMethod() and QObject::connect(). See \l {Exchanging data between QML and C++} +below for further details. + +\section3 Locating child objects + +QML components are essentially object trees with children that have siblings and their own children. +Child objects of QML components can be located using the QObject::objectName property with +QObject::findChild(). For example, if the root item in \c MyItem.qml had a child \l Rectangle item: + +\snippet doc/src/snippets/declarative/qtbinding/loading/MyItem.qml start +\codeline +\snippet doc/src/snippets/declarative/qtbinding/loading/MyItem.qml child +\snippet doc/src/snippets/declarative/qtbinding/loading/MyItem.qml end + +The child could be located like this: + +\snippet doc/src/snippets/declarative/qtbinding/loading/main.cpp findChild + +If \c objectName is used inside a delegate of a ListView, \l Repeater or some other +element that creates multiple instances of its delegates, there will be multiple children with +the same \c objectName. In this case, QObject::findChildren() can be used to find all children +with a matching \c objectName. + +\warning While it is possible to use C++ to access and manipulate QML objects deep into the +object tree, we recommend that you do not take this approach outside of application +testing and prototyping. One strength of QML and C++ integration is the ability to implement the +QML user interface separately from the C++ logic and dataset backend, and this strategy breaks if the +C++ side reaches deep into the QML components to manipulate them directly. This would make it difficult +to, for example, swap a QML view component for another view, if the new component was missing a +required \c objectName. It is better for the C++ implementation to know as little as possible about +the QML user interface implementation and the composition of the QML object tree. + + +\section2 Embedding C++ objects into QML components + +When loading a QML scene into a C++ application, it can be useful to directly embed C++ data into +the QML object. QDeclarativeContext enables this by exposing data to the context of a QML +component, allowing data to be injected from C++ into QML. + +For example, here is a QML item that refers to a \c currentDateTime value that does not exist in +the current scope: + +\snippet doc/src/snippets/declarative/qtbinding/context/MyItem.qml 0 + +This \c currentDateTime value can be set directly by the C++ application that loads the QML +component, using QDeclarativeContext::setContextProperty(): + +\snippet doc/src/snippets/declarative/qtbinding/context/main.cpp 0 + +Context properties can hold either QVariant or QObject* values. This means custom C++ objects can +also be injected using this approach, and these objects can be modified and read directly in QML. +Here, we modify the above example to embed a QObject instance instead of a QDateTime value, and the QML code +invokes a method on the object instance: + +\table +\row +\o +\snippet doc/src/snippets/declarative/qtbinding/context-advanced/applicationdata.h 0 +\codeline +\snippet doc/src/snippets/declarative/qtbinding/context-advanced/main.cpp 0 +\o +\snippet doc/src/snippets/declarative/qtbinding/context-advanced/MyItem.qml 0 +\endtable + +(Note that date/time values returned from C++ to QML can be formatted through +\l{QML:Qt::formatDateTime}{Qt.formatDateTime()} and associated functions.) + +If the QML item needs to receive signals from the context property, it can connect to them using the +\l Connections element. For example, if \c ApplicationData has a signal named \c +dataChanged(), this signal can be connected to using an \c onDataChanged handler within +a \l Connections object: + +\snippet doc/src/snippets/declarative/qtbinding/context-advanced/connections.qml 0 + +Context properties can be useful for using C++ based data models in a QML view. See the +\l {declarative/modelviews/stringlistmodel}{String ListModel}, +\l {declarative/modelviews/objectlistmodel}{Object ListModel} and +\l {declarative/modelviews/abstractitemmodel}{AbstractItemModel} models for +respective examples on using QStringListModel, QObjectList-based models and QAbstractItemModel +in QML views. + +Also see the QDeclarativeContext documentation for more information. + + +\section2 Defining new QML elements + +While new QML elements can be \l {Defining new Components}{defined in QML}, they can also be +defined by C++ classes; in fact, many of the core \l {QML Elements} are implemented through +C++ classes. When you create a QML object using one of these elements, you are simply creating an +instance of a QObject-based C++ class and setting its properties. + +For example, here is an \c ImageViewer class with an \c image URL property: + +\snippet doc/src/snippets/declarative/qtbinding/newelements/imageviewer.h 0 + +Aside from the fact that it inherits QDeclarativeItem, this is an ordinary class that could +exist outside of QML. However, once it is registered with the QML engine using qmlRegisterType(): + +\snippet doc/src/snippets/declarative/qtbinding/newelements/main.cpp register + +Then, any QML code loaded by your C++ application or \l{QDeclarativeExtensionPlugin}{plugin} can create and manipulate +\c ImageViewer objects: + +\snippet doc/src/snippets/declarative/qtbinding/newelements/standalone.qml 0 + +Note that custom C++ types do not have to inherit from QDeclarativeItem; this is only necessary if it is +a displayable item. If the item is not displayable, it can simply inherit from QObject. + +For more information on defining new QML elements, see the \l {Tutorial: Writing QML extensions with C++} +{Writing QML extensions with C++} tutorial and the \l {Extending QML in C++} reference +documentation. + + + +\section1 Exchanging data between QML and C++ + +QML and C++ objects can communicate with one another through signals, slots and property +modifications. For a C++ object, any data that is exposed to Qt's \l{The Meta-Object System}{Meta-Object System} +- that is, properties, signals, slots and Q_INVOKABLE methods - become available to QML. On +the QML side, all QML object data is automatically made available to the meta-object system and can +be accessed from C++. + + +\section2 Calling functions -QML components are instantiated in a QDeclarativeContext. A context allows the application to expose data -to the QML component instance. A single QDeclarativeContext can be used to instantiate all the objects -used by an application, or several QDeclarativeContext can be created for more fine grained control over -the data exposed to each instance. If a context is not passed to the QDeclarativeComponent::create() -method, the QDeclarativeEngine's \l {QDeclarativeEngine::rootContext()}{root context} is used. Data exposed through -the root context is available to all object instances. +QML functions can be called from C++ and vice-versa. -\section1 Simple Data +All QML functions are exposed to the meta-object system and can be called using +QMetaObject::invokeMethod(). Here is a C++ application that uses this to call a QML function: -To expose data to a QML component instance, applications set \l {QDeclarativeContext::setContextProperty()} -{context properties} which are then accessible by name from QML \l {Property Binding}s and JavaScript. -The following example shows how to expose a background color to a QML file through QDeclarativeView: +\table +\row +\o \snippet doc/src/snippets/declarative/qtbinding/functions-qml/MyItem.qml 0 +\o \snippet doc/src/snippets/declarative/qtbinding/functions-qml/main.cpp 0 +\endtable + +Notice the Q_RETURN_ARG() and Q_ARG() arguments for QMetaObject::invokeMethod() must be specified as +QVariant types, as this is the generic data type used for QML functions and return values. + +To call a C++ function from QML, the function must be either a Qt slot, or a function marked with +the Q_INVOKABLE macro, to be available to QML. In the following example, the QML code invokes +methods on the \c myObject object, which has been set using QDeclarativeContext::setContextProperty(): + +\table +\row +\o +\snippet doc/src/snippets/declarative/qtbinding/functions-cpp/MyItem.qml 0 +\o +\snippet doc/src/snippets/declarative/qtbinding/functions-cpp/myclass.h 0 +\codeline +\snippet doc/src/snippets/declarative/qtbinding/functions-cpp/main.cpp 0 +\endtable + +Note that QML does not support overloaded functions. If a C++ has more than one function with the +same name, there is no guarantee which overloaded function will be called from QML. + + +\section2 Receiving signals + +All QML signals are automatically available to C++, and can be connected to using QObject::connect() +like any ordinary Qt C++ signal. + +Here is a QML component with a signal named \c qmlSignal. This signal is connected to a C++ object's +slot using QObject::connect(): + +\table +\row +\o +\snippet doc/src/snippets/declarative/qtbinding/signals-qml/MyItem.qml 0 +\o +\snippet doc/src/snippets/declarative/qtbinding/signals-qml/myclass.h 0 +\codeline +\snippet doc/src/snippets/declarative/qtbinding/signals-qml/main.cpp 0 +\endtable + +To connect to Qt C++ signals from within QML, use a signal handler with the \c on syntax. +If the C++ object is directly creatable from within QML (see \l {Defining new QML elements} above) +then the signal handler can be defined within the object declaration. In the following example, the +QML code creates a \c ImageViewer object, and the \c imageChanged and \c loadingError signals of the +C++ object are connected to through \c onImagedChanged and \c onLoadingError signal handlers in QML: \table \row \o -\c {// main.cpp} -\snippet doc/src/snippets/declarative/qtbinding/contextproperties/main.cpp 0 + +\snippet doc/src/snippets/declarative/qtbinding/signals-cpp/imageviewer.h start +\dots 4 +\snippet doc/src/snippets/declarative/qtbinding/signals-cpp/imageviewer.h end \o -\c {// main.qml} -\snippet doc/src/snippets/declarative/qtbinding/contextproperties/main.qml 0 +\snippet doc/src/snippets/declarative/qtbinding/signals-cpp/standalone.qml 0 +\endtable + +(Note that if a signal has been declared as the NOTIFY signal for a property, QML allows it to be +received with an \c onChanged handler even if the signal's name does not follow the \c +Changed naming convention. In the above example, if the "imageChanged" signal was named +"imageModified" instead, the \c onImageChanged signal handler would still be called.) + +If, however, the object with the signal is not created from within the QML code, and the QML item only has a +reference to the created object - for example, if the object was set using +QDeclarativeContext::setContextProperty() - then the \l Connections element can be used +instead to create the signal handler: +\table +\row +\o \snippet doc/src/snippets/declarative/qtbinding/signals-cpp/main.cpp connections +\o \snippet doc/src/snippets/declarative/qtbinding/signals-cpp/MyItem.qml 0 \endtable -Or, if you want \c main.cpp to create the component without showing it in a QDeclarativeView, you could create an instance of QDeclarativeContext using QDeclarativeEngine::rootContext() instead: -\snippet doc/src/snippets/declarative/qtbinding/contextproperties/main.cpp 1 +\section2 Modifying properties -Context properties work just like normal properties in QML bindings - if the \c backgroundColor -context property in this example was changed to red, the component object instances would -all be automatically updated. Note that it is the responsibility of the creator to delete any -QDeclarativeContext it constructs. If the \c windowContext is no longer needed when -the \c window component instantiation is destroyed, the \c windowContext must be destroyed -explicitly. The simplest way to ensure this is to set \c window as \c windowContext's parent. +Any properties declared in a QML object are automatically accessible from C++. Given a QML item +like this: -QDeclarativeContexts form a tree - each QDeclarativeContext except for the root context has a parent. Child -QDeclarativeContexts effectively inherit the context properties present in their parents. This gives -applications more freedom in partitioning the data exposed to different QML object instances. -If a QDeclarativeContext sets a context property that is also set in one of its parents, the new context -property shadows that in the parent. In The following example, the \c background context property -in \c {Context 1} shadows the \c background context property in the root context. +\snippet doc/src/snippets/declarative/qtbinding/properties-qml/MyItem.qml 0 -\image qml-context-tree.png +The value of the \c someNumber property can be set and read using QDeclarativeProperty, or +QObject::setProperty() and QObject::property(): -\section2 Structured Data +\snippet doc/src/snippets/declarative/qtbinding/properties-qml/main.cpp 0 -Context properties can also be used to expose structured and writable data to QML objects. In -addition to all the types already supported by QVariant, QObject derived types can be assigned to -context properties. QObject context properties allow the data exposed to be more structured, and -allow QML to set values. +You should always use QObject::setProperty(), QDeclarativeProperty or QMetaProperty::write() to +change a QML property value, to ensure the QML engine is made aware of the property change. For example, +say you have a custom element \c PushButton with a \c buttonText property that internally reflects +the value of a \c m_buttonText member variable. Modifying the member variable directly like this is +not a good idea: -The following example creates a \c CustomPalette object, and sets it as the \c palette context -property. +\badcode +// BAD! +QDeclarativeComponent component(engine, "MyButton.qml"); +PushButton *button = qobject_cast(component.create()); +button->m_buttonText = "Click me"; +\endcode -\snippet doc/src/snippets/declarative/qtbinding/custompalette/custompalette.h 0 +Since the value is changed directly, this bypasses Qt's \l{The Meta-Object System}{meta-object system} +and the QML engine is not made aware of the property change. This means property bindings to +\c buttonText would not be updated, and any \c onButtonTextChanged handlers would not be called. -\snippet doc/src/snippets/declarative/qtbinding/custompalette/main.cpp 0 -The QML that follows references the palette object, and its properties, to set the appropriate -background and text colors. When the window is clicked, the palette's text color is changed, and -the window text will update accordingly. +\target properties-cpp -\snippet doc/src/snippets/declarative/qtbinding/custompalette/main.qml 0 +Any \l {The Property System}{Qt properties} - that is, those declared with the Q_PROPERTY() +macro - are accessible from QML. Here is a modified version of the \l {Embedding C++ objects into +QML components}{earlier example} on this page; here, the \c ApplicationData class has a \c backgroundColor +property. This property can be written to and read from QML: -To detect when a C++ property value - in this case the \c CustomPalette's \c text property - -changes, the property must have a corresponding NOTIFY signal. The NOTIFY signal specifies a signal -that is emitted whenever the property changes value. Implementers should take care to only emit the -signal if the value \e changes to prevent loops from occurring. Accessing a property from a -binding that does not have a NOTIFY signal will cause QML to issue a warning at runtime. +\table +\row +\o \snippet doc/src/snippets/declarative/qtbinding/properties-cpp/applicationdata.h 0 +\o \snippet doc/src/snippets/declarative/qtbinding/properties-cpp/MyItem.qml 0 +\endtable -\section2 Dynamic Structured Data +Notice the \c backgroundColorChanged signal is declared as the NOTIFY signal for the +\c backgroundColor property. If a Qt property does not have an associated NOTIFY signal, +the property cannot be used for \l {Property Binding} in QML, as the QML engine would not be +notified when the value changes. If you are using custom types in QML, make sure their +properties have NOTIFY signals so that they can be used in property bindings. -If an application is too dynamic to structure data as compile-time QObject types, dynamically -structured data can be constructed at runtime using the QDeclarativePropertyMap class. +See \l {Tutorial: Writing QML extensions with C++} for further details and examples +on using Qt properties with QML. -\section1 Calling C++ methods from QML +\section1 Supported data types -It is possible to call methods of QObject derived types by either exposing the -methods as public slots, or by marking the methods Q_INVOKABLE. +Any C++ data that is used from QML - whether as custom properties, or parameters for signals or +functions - must be of a type that is recognizable by QML. -The C++ methods can also have parameters and return values. QML has support for -the following types: +By default, QML recognizes the following data types: \list \o bool @@ -163,102 +426,168 @@ the following types: \o QSize, QSizeF \o QRect, QRectF \o QVariant +\o QObject* +\o Enumerations declared with Q_ENUMS() \endlist -This example toggles the "Stopwatch" object on/off when the MouseArea is clicked: +To allow a custom C++ type to be created or used in QML, the C++ class must be registered as a QML +type using qmlRegisterType(), as shown in the \l {Defining new QML elements} section above. -\table -\row -\o -\c {// main.cpp} -\snippet doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.h 0 -\snippet doc/src/snippets/declarative/qtbinding/stopwatch/main.cpp 0 -\o -\c {// main.qml} -\snippet doc/src/snippets/declarative/qtbinding/stopwatch/main.qml 0 +\section2 Using enumerations of a custom type -\endtable +To use an enumeration from a custom C++ component, the enumeration must be declared with Q_ENUMS() to +register it with Qt's meta object system. For example, the following C++ type has a \c Status enum: -Note that in this particular example a better way to achieve the same result -is to have a "running" property in \c main.qml. This leads to much nicer QML code: +\snippet doc/src/snippets/declarative/qtbinding/enums/imageviewer.h start +\snippet doc/src/snippets/declarative/qtbinding/enums/imageviewer.h end + +Providing the \c ImageViewer class has been registered using qmlRegisterType(), its \c Status enum can +now be used from QML: + +\snippet doc/src/snippets/declarative/qtbinding/enums/standalone.qml 0 + +The C++ type must be registered with QML to use its enums. If your C++ type is not instantiable, it +can be registered using qmlRegisterUncreatableType(). + +See the \l {Tutorial: Writing QML extensions with C++}{Writing QML extensions with C++} tutorial and +the \l {Extending QML in C++} reference documentation for more information. + + +\section2 Automatic type conversion + +As a convenience, some basic types can be specified in QML using format strings to make it easier to +pass simple values from QML to C++. \table +\header +\o Type +\o String format +\o Example \row -\o -\code -// main.qml -import QtQuick 1.0 - -Rectangle { - MouseArea { - anchors.fill: parent - onClicked: stopwatch.running = !stopwatch.running - } -} -\endcode +\o QColor +\o Color name, "#RRGGBB", "#RRGGBBAA" +\o "red", "#ff0000", "#ff000000" +\row +\o QDate +\o "YYYY-MM-DD" +\o "2010-05-31" +\row +\o QPoint +\o "x,y" +\o "10,20" +\row +\o QRect +\o "x,y,WidthxHeight" +\o "50,50,100x100" +\row +\o QSize +\o "WidthxHeight" +\o "100x200" +\row +\o QTime +\o "hh:mm:ss" +\o "14:22:55" +\row +\o QUrl +\o URL string +\o "http://www.example.com" +\row +\o QVector3D +\o "x,y,z" +\o "0,1,0" +\row +\o Enumeration value +\o Enum value name +\o "AlignRight" \endtable -Of course, it is also possible to call \l {Adding new methods}{functions declared in QML from C++}. +(More details on these string formats and types can be found in the +\l {QML Basic Types}{basic type documentation}.) + +These string formats can be used to set QML \c property values and pass arguments to C++ +functions. This is demonstrated by various examples on this page; in the above +\l{#properties-cpp}{Qt properties example}, the \c ApplicationData class has a \c backgroundColor +property of a QColor type, which is set from the QML code with the string "red" rather rather +than an actual QColor object. + +If it is preferred to pass an explicitly-typed value rather than a string, the global +\l{QmlGlobalQtObject}{Qt object} provides convenience functions for creating some of the object +types listed above. For example, \l{QML:Qt::rgba()}{Qt.rgba()} creates a QColor value from four +RGBA values. The QColor returned from this function could be used instead of a string to set +a QColor-type property or to call a C++ function that requires a QColor parameter. + + +\section1 Writing QML plugins + +The QtDeclarative module includes the QDeclarativeExtensionPlugin class, which is an abstract +class for writing QML plugins. This allows QML extension types to be dynamically loaded into +QML applications. + +See the QDeclarativeExtensionPlugin documentation and \l {How to Create Qt Plugins} for more +details. + + +\section1 Managing resource files with the Qt resource system +The \l {The Qt Resource System}{Qt resource system} allows resource files to be stored as +binary files in an application executable. This can be useful when building a mixed +QML/C++ application as it enables QML files (as well as other resources such as images +and sound files) to be referred to through the resource system URI scheme rather than +relative or absolute paths to filesystem resources. Note, however, that if you use the resource +system, the application executable must be re-compiled whenever a QML source file is changed +in order to update the resources in the package. -\section1 Network Components +To use the resource system in a mixed QML/C++ application: -If the URL passed to QDeclarativeComponent is a network resource, or if the QML document references a -network resource, the QDeclarativeComponent has to fetch the network data before it is able to create -objects. In this case, the QDeclarativeComponent will have a \l {QDeclarativeComponent::Loading}{Loading} -\l {QDeclarativeComponent::status()}{status}. An application will have to wait until the component -is \l {QDeclarativeComponent::Ready}{Ready} before calling \l {QDeclarativeComponent::create()}. +\list +\o Create a \c .qrc \l {The Qt Resource System}{resource collection file} that lists resource + files in XML format +\o From C++, load the main QML file as a resource using the \c :/ prefix or as a URL with the + \c qrc scheme +\endlist + +Once this is done, all files specified by relative paths in QML will be loaded from +the resource system instead. Use of the resource system is completely transparent to +the QML layer; this means all QML code should refer to resource files using relative +paths and should \e not use the \c qrc scheme. This scheme should only be used from +C++ code for referring to resource files. -The following example shows how to load a QML file from a network resource. After creating -the QDeclarativeComponent, it tests whether the component is loading. If it is, it connects to the -QDeclarativeComponent::statusChanged() signal and otherwise calls the \c {continueLoading()} method -directly. This test is necessary, even for URLs that are known to be remote, just in case -the component has been cached and is ready immediately. +Here is a application packaged using the \l {The Qt Resource System}{Qt resource system}. +The directory structure looks like this: \code -MyApplication::MyApplication() -{ - // ... - component = new QDeclarativeComponent(engine, QUrl("http://www.example.com/main.qml")); - if (component->isLoading()) - QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), - this, SLOT(continueLoading())); - else - continueLoading(); -} - -void MyApplication::continueLoading() -{ - if (component->isError()) { - qWarning() << component->errors(); - } else { - QObject *myObject = component->create(); - } -} +project + |- example.qrc + |- main.qml + |- images + |- background.png + |- main.cpp + |- project.pro \endcode -\section1 Qt Resources +The \c main.qml and \c background.png files will be packaged as resource files. This is +done in the \c example.qrc resource collection file: -QML content can be loaded from \l {The Qt Resource System} using the \e qrc: URL scheme. -For example: +\quotefile doc/src/snippets/declarative/qtbinding/resources/example.qrc -\c [project/example.qrc] -\quotefile doc/src/snippets/declarative/qtbinding/resources/example.qrc +Since \c background.png is a resource file, \c main.qml can refer to it using the relative +path specified in \c example.qrc: + +\snippet doc/src/snippets/declarative/qtbinding/resources/main.qml 0 -\c [project/project.pro] -\quotefile doc/src/snippets/declarative/qtbinding/resources/resources.pro +To allow QML to locate resource files correctly, the \c main.cpp loads the main QML +file, \c main.qml, as a resource file using the \c qrc scheme: -\c [project/main.cpp] \snippet doc/src/snippets/declarative/qtbinding/resources/main.cpp 0 -\c [project/main.qml] -\snippet doc/src/snippets/declarative/qtbinding/resources/main.qml 0 +Finally \c project.pro uses the RESOURCES variable to indicate that \c example.qrc should +be used to build the application resources: + +\quotefile doc/src/snippets/declarative/qtbinding/resources/resources.pro + +See \l {The Qt Resource System} for more information. -Note that the resource system cannot be accessed from QML directly. If the main QML file is -loaded as a resource, all files specified as relative paths in QML will also be loaded from -the resource system. Using the resource system is completely transparent to the QML layer. -This also means that if the main QML file is not loaded as a resource then files in the resource -system cannot be accessed from QML. */ + diff --git a/doc/src/snippets/declarative/qtbinding/context-advanced/MyItem.qml b/doc/src/snippets/declarative/qtbinding/context-advanced/MyItem.qml new file mode 100644 index 0000000..607651a --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/context-advanced/MyItem.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// MyItem.qml +import QtQuick 1.0 + +Text { text: applicationData.getCurrentDateTime() } +//![0] + diff --git a/doc/src/snippets/declarative/qtbinding/context-advanced/applicationdata.h b/doc/src/snippets/declarative/qtbinding/context-advanced/applicationdata.h new file mode 100644 index 0000000..930e381 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/context-advanced/applicationdata.h @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +//![0] +class ApplicationData : public QObject +{ + Q_OBJECT +public: + Q_INVOKABLE QDateTime getCurrentDateTime() const { + return QDateTime::currentDateTime(); + } +}; +//![0] diff --git a/doc/src/snippets/declarative/qtbinding/context-advanced/connections.qml b/doc/src/snippets/declarative/qtbinding/context-advanced/connections.qml new file mode 100644 index 0000000..749bea3 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/context-advanced/connections.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 1.0 + +//![0] +Text { + text: applicationData.getCurrentDateTime() + + Connections { + target: applicationData + onDataChanged: console.log("The application data changed!") + } +} +//![0] + diff --git a/doc/src/snippets/declarative/qtbinding/context-advanced/context-advanced.pro b/doc/src/snippets/declarative/qtbinding/context-advanced/context-advanced.pro new file mode 100644 index 0000000..188a9fb --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/context-advanced/context-advanced.pro @@ -0,0 +1,3 @@ +QT += declarative +SOURCES += main.cpp +HEADERS += applicationdata.h diff --git a/doc/src/snippets/declarative/qtbinding/context-advanced/main.cpp b/doc/src/snippets/declarative/qtbinding/context-advanced/main.cpp new file mode 100644 index 0000000..b92215b --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/context-advanced/main.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +#include "applicationdata.h" + +//![0] +int main(int argc, char *argv[]) { + QApplication app(argc, argv); + + QDeclarativeView view; + + ApplicationData data; + view.rootContext()->setContextProperty("applicationData", &data); + + view.setSource(QUrl::fromLocalFile("MyItem.qml")); + view.show(); + + return app.exec(); +} +//![0] + diff --git a/doc/src/snippets/declarative/qtbinding/context/MyItem.qml b/doc/src/snippets/declarative/qtbinding/context/MyItem.qml new file mode 100644 index 0000000..faa42dc --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/context/MyItem.qml @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// MyItem.qml +import QtQuick 1.0 + +Text { text: currentDateTime } +//![0] diff --git a/doc/src/snippets/declarative/qtbinding/context/context.pro b/doc/src/snippets/declarative/qtbinding/context/context.pro new file mode 100644 index 0000000..68eeaf2 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/context/context.pro @@ -0,0 +1,2 @@ +QT += declarative +SOURCES += main.cpp diff --git a/doc/src/snippets/declarative/qtbinding/context/main.cpp b/doc/src/snippets/declarative/qtbinding/context/main.cpp new file mode 100644 index 0000000..bbe9956 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/context/main.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + +//![0] +QDeclarativeView view; +view.rootContext()->setContextProperty("currentDateTime", QDateTime::currentDateTime()); +view.setSource(QUrl::fromLocalFile("MyItem.qml")); +view.show(); +//![0] + + return app.exec(); +} + diff --git a/doc/src/snippets/declarative/qtbinding/contextproperties/contextproperties.pro b/doc/src/snippets/declarative/qtbinding/contextproperties/contextproperties.pro deleted file mode 100644 index 68eeaf2..0000000 --- a/doc/src/snippets/declarative/qtbinding/contextproperties/contextproperties.pro +++ /dev/null @@ -1,2 +0,0 @@ -QT += declarative -SOURCES += main.cpp diff --git a/doc/src/snippets/declarative/qtbinding/contextproperties/main.cpp b/doc/src/snippets/declarative/qtbinding/contextproperties/main.cpp deleted file mode 100644 index 6887e8f..0000000 --- a/doc/src/snippets/declarative/qtbinding/contextproperties/main.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -//![0] -#include -#include -#include - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QDeclarativeView view; - QDeclarativeContext *context = view.rootContext(); - context->setContextProperty("backgroundColor", - QColor(Qt::yellow)); - - view.setSource(QUrl::fromLocalFile("main.qml")); - view.show(); - - return app.exec(); -} -//![0] - -static void alternative() -{ - // Alternatively, if we don't actually want to display main.qml: -//![1] - QDeclarativeEngine engine; - QDeclarativeContext *windowContext = new QDeclarativeContext(engine.rootContext()); - windowContext->setContextProperty("backgroundColor", QColor(Qt::yellow)); - - QDeclarativeComponent component(&engine, "main.qml"); - QObject *window = component.create(windowContext); -//![1] -} - - diff --git a/doc/src/snippets/declarative/qtbinding/contextproperties/main.qml b/doc/src/snippets/declarative/qtbinding/contextproperties/main.qml deleted file mode 100644 index 425346d..0000000 --- a/doc/src/snippets/declarative/qtbinding/contextproperties/main.qml +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -import QtQuick 1.0 - -Rectangle { - width: 300 - height: 300 - - color: backgroundColor - - Text { - anchors.centerIn: parent - text: "Hello Yellow World!" - } -} -//![0] diff --git a/doc/src/snippets/declarative/qtbinding/custompalette/custompalette.h b/doc/src/snippets/declarative/qtbinding/custompalette/custompalette.h deleted file mode 100644 index 7e84bd4..0000000 --- a/doc/src/snippets/declarative/qtbinding/custompalette/custompalette.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -//![0] -class CustomPalette : public QObject -{ - Q_OBJECT - Q_PROPERTY(QColor background READ background WRITE setBackground NOTIFY backgroundChanged) - Q_PROPERTY(QColor text READ text WRITE setText NOTIFY textChanged) - -public: - CustomPalette() : m_background(Qt::white), m_text(Qt::black) {} - - QColor background() const { return m_background; } - void setBackground(const QColor &c) { - if (c != m_background) { - m_background = c; - emit backgroundChanged(); - } - } - - QColor text() const { return m_text; } - void setText(const QColor &c) { - if (c != m_text) { - m_text = c; - emit textChanged(); - } - } - -signals: - void textChanged(); - void backgroundChanged(); - -private: - QColor m_background; - QColor m_text; -}; - -//![0] diff --git a/doc/src/snippets/declarative/qtbinding/custompalette/custompalette.pro b/doc/src/snippets/declarative/qtbinding/custompalette/custompalette.pro deleted file mode 100644 index e6af0d0..0000000 --- a/doc/src/snippets/declarative/qtbinding/custompalette/custompalette.pro +++ /dev/null @@ -1,3 +0,0 @@ -QT += declarative -HEADERS += custompalette.h -SOURCES += main.cpp diff --git a/doc/src/snippets/declarative/qtbinding/custompalette/main.cpp b/doc/src/snippets/declarative/qtbinding/custompalette/main.cpp deleted file mode 100644 index 7481b75..0000000 --- a/doc/src/snippets/declarative/qtbinding/custompalette/main.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include "custompalette.h" - -//![0] -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QDeclarativeView view; - view.rootContext()->setContextProperty("palette", new CustomPalette); - - view.setSource(QUrl::fromLocalFile("main.qml")); - view.show(); - - return app.exec(); -} -//![0] - diff --git a/doc/src/snippets/declarative/qtbinding/custompalette/main.qml b/doc/src/snippets/declarative/qtbinding/custompalette/main.qml deleted file mode 100644 index a20d9e0..0000000 --- a/doc/src/snippets/declarative/qtbinding/custompalette/main.qml +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -import QtQuick 1.0 - -Rectangle { - width: 240 - height: 320 - color: palette.background - - Text { - anchors.centerIn: parent - color: palette.text - text: "Click me to change color!" - } - - MouseArea { - anchors.fill: parent - onClicked: { - palette.text = "blue"; - } - } -} -//![0] diff --git a/doc/src/snippets/declarative/qtbinding/enums/enums.pro b/doc/src/snippets/declarative/qtbinding/enums/enums.pro new file mode 100644 index 0000000..82bc123 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/enums/enums.pro @@ -0,0 +1,3 @@ +QT += declarative +SOURCES += main.cpp +HEADERS += imageviewer.h diff --git a/doc/src/snippets/declarative/qtbinding/enums/imageviewer.h b/doc/src/snippets/declarative/qtbinding/enums/imageviewer.h new file mode 100644 index 0000000..8aaddee --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/enums/imageviewer.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +//![start] +class ImageViewer : public QDeclarativeItem +{ + Q_OBJECT + Q_ENUMS(Status) + Q_PROPERTY(Status status READ status NOTIFY statusChanged) +public: + enum Status { + Ready, + Loading, + Error + }; + + Status status() const; +//![start] + + ImageViewer(QDeclarativeItem *parent = 0); + +public slots: + void emitSignals(); + +//![end] +signals: + void statusChanged(); +}; +//![end] diff --git a/doc/src/snippets/declarative/qtbinding/enums/main.cpp b/doc/src/snippets/declarative/qtbinding/enums/main.cpp new file mode 100644 index 0000000..9243f4b --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/enums/main.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +#include "imageviewer.h" + +ImageViewer::ImageViewer(QDeclarativeItem *parent) + : QDeclarativeItem(parent) +{ + QTimer::singleShot(0, this, SLOT(emitSignals())); +} + +ImageViewer::Status ImageViewer::status() const +{ + return Ready; +} + +void ImageViewer::emitSignals() +{ + emit statusChanged(); +} + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + qmlRegisterType("MyLibrary", 1, 0, "ImageViewer"); + + QDeclarativeView view; + view.setSource(QUrl::fromLocalFile("standalone.qml")); + view.show(); + + return app.exec(); +} + diff --git a/doc/src/snippets/declarative/qtbinding/enums/standalone.qml b/doc/src/snippets/declarative/qtbinding/enums/standalone.qml new file mode 100644 index 0000000..ad6c14c --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/enums/standalone.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +import MyLibrary 1.0 + +//![0] +ImageViewer { + onStatusChanged: { + if (status == ImageViewer.Ready) + console.log("Image viewer is ready!") + } +} +//![0] diff --git a/doc/src/snippets/declarative/qtbinding/functions-cpp/MyItem.qml b/doc/src/snippets/declarative/qtbinding/functions-cpp/MyItem.qml new file mode 100644 index 0000000..8d8cd56 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/functions-cpp/MyItem.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// MyItem.qml +import QtQuick 1.0 + +Item { + width: 100; height: 100 + + MouseArea { + anchors.fill: parent + onClicked: { + myObject.cppMethod("Hello from QML") + myObject.cppSlot(12345) + } + } +} +//![0] diff --git a/doc/src/snippets/declarative/qtbinding/functions-cpp/functions-qml.pro b/doc/src/snippets/declarative/qtbinding/functions-cpp/functions-qml.pro new file mode 100644 index 0000000..01066c1 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/functions-cpp/functions-qml.pro @@ -0,0 +1,3 @@ +QT += declarative +SOURCES += main.cpp +HEADERS += myclass.h diff --git a/doc/src/snippets/declarative/qtbinding/functions-cpp/main.cpp b/doc/src/snippets/declarative/qtbinding/functions-cpp/main.cpp new file mode 100644 index 0000000..91d6aec --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/functions-cpp/main.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +#include "myclass.h" + +//![0] +int main(int argc, char *argv[]) { + QApplication app(argc, argv); + + QDeclarativeView view; + MyClass myClass; + view.rootContext()->setContextProperty("myObject", &myClass); + + view.setSource(QUrl::fromLocalFile("MyItem.qml")); + view.show(); + + return app.exec(); +} +//![0] + diff --git a/doc/src/snippets/declarative/qtbinding/functions-cpp/myclass.h b/doc/src/snippets/declarative/qtbinding/functions-cpp/myclass.h new file mode 100644 index 0000000..76c628e --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/functions-cpp/myclass.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +//![0] +class MyClass : public QObject +{ + Q_OBJECT +public: + Q_INVOKABLE void cppMethod(const QString &msg) { + qDebug() << "Called the C++ method with" << msg; + } + +public slots: + void cppSlot(int number) { + qDebug() << "Called the C++ slot with" << number; + } +}; +//![0] diff --git a/doc/src/snippets/declarative/qtbinding/functions-qml/MyItem.qml b/doc/src/snippets/declarative/qtbinding/functions-qml/MyItem.qml new file mode 100644 index 0000000..6161d6e --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/functions-qml/MyItem.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// MyItem.qml +import QtQuick 1.0 + +Item { + function myQmlFunction(msg) { + console.log("Got message:", msg) + return "some return value" + } +} +//![0] diff --git a/doc/src/snippets/declarative/qtbinding/functions-qml/functions-qml.pro b/doc/src/snippets/declarative/qtbinding/functions-qml/functions-qml.pro new file mode 100644 index 0000000..68eeaf2 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/functions-qml/functions-qml.pro @@ -0,0 +1,2 @@ +QT += declarative +SOURCES += main.cpp diff --git a/doc/src/snippets/declarative/qtbinding/functions-qml/main.cpp b/doc/src/snippets/declarative/qtbinding/functions-qml/main.cpp new file mode 100644 index 0000000..3e9e51e --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/functions-qml/main.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + +//![0] +// main.cpp +QDeclarativeEngine engine; +QDeclarativeComponent component(&engine, "MyItem.qml"); +QObject *object = component.create(); + +QVariant returnedValue; +QVariant msg = "Hello from C++"; +QMetaObject::invokeMethod(object, "myQmlFunction", + Q_RETURN_ARG(QVariant, returnedValue), + Q_ARG(QVariant, msg)); + +qDebug() << "QML function returned:" << returnedValue.toString(); +delete object; +//![0] +} + diff --git a/doc/src/snippets/declarative/qtbinding/loading/MyItem.qml b/doc/src/snippets/declarative/qtbinding/loading/MyItem.qml new file mode 100644 index 0000000..40138f6 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/loading/MyItem.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![start] +import QtQuick 1.0 + +Item { + width: 100; height: 100 +//![start] + +//![child] + Rectangle { + anchors.fill: parent + objectName: "rect" + } +//![child] + +//![end] +} +//![end] diff --git a/doc/src/snippets/declarative/qtbinding/loading/loading.pro b/doc/src/snippets/declarative/qtbinding/loading/loading.pro new file mode 100644 index 0000000..68eeaf2 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/loading/loading.pro @@ -0,0 +1,2 @@ +QT += declarative +SOURCES += main.cpp diff --git a/doc/src/snippets/declarative/qtbinding/loading/main.cpp b/doc/src/snippets/declarative/qtbinding/loading/main.cpp new file mode 100644 index 0000000..bd400b0 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/loading/main.cpp @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +static void withComponent() +{ +//![QDeclarativeComponent-a] +// Using QDeclarativeComponent +QDeclarativeEngine engine; +QDeclarativeComponent component(&engine, + QUrl::fromLocalFile("MyItem.qml")); +QObject *object = component.create(); +//![QDeclarativeComponent-a] +} + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + +//![QDeclarativeView] +// Using QDeclarativeView +QDeclarativeView view; +view.setSource(QUrl::fromLocalFile("MyItem.qml")); +view.show(); +QObject *object = view.rootObject(); +//![QDeclarativeView] + +//![properties] +object->setProperty("width", 500); +QDeclarativeProperty(object, "width").write(500); +//![properties] + +//![cast] +QDeclarativeItem *item = qobject_cast(object); +item->setWidth(500); +//![cast] + +//![findChild] +QObject *rect = object->findChild("rect"); +if (rect) + rect->setProperty("color", "red"); +//![findChild] + +//![QDeclarativeComponent-b] +delete object; +//![QDeclarativeComponent-b] + +withComponent(); + + return app.exec(); +} + diff --git a/doc/src/snippets/declarative/qtbinding/newelements/imageviewer.h b/doc/src/snippets/declarative/qtbinding/newelements/imageviewer.h new file mode 100644 index 0000000..fd9db5e --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/newelements/imageviewer.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +//![0] +class ImageViewer : public QDeclarativeItem +{ + Q_OBJECT + Q_PROPERTY(QUrl image READ image WRITE setImage NOTIFY imageChanged) + +public: + void setImage(const QUrl &url); + QUrl image() const; + +signals: + void imageChanged(); +}; +//![0] diff --git a/doc/src/snippets/declarative/qtbinding/newelements/main.cpp b/doc/src/snippets/declarative/qtbinding/newelements/main.cpp new file mode 100644 index 0000000..57994ca --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/newelements/main.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +#include "imageviewer.h" + +void ImageViewer::setImage(const QUrl &url) {} +QUrl ImageViewer::image() const { return QUrl(); } + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + //![register] + qmlRegisterType("MyLibrary", 1, 0, "ImageViewer"); + //![register] + + QDeclarativeView view; + view.setSource(QUrl::fromLocalFile("standalone.qml")); + view.show(); + + return app.exec(); +} + diff --git a/doc/src/snippets/declarative/qtbinding/newelements/newelements.pro b/doc/src/snippets/declarative/qtbinding/newelements/newelements.pro new file mode 100644 index 0000000..82bc123 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/newelements/newelements.pro @@ -0,0 +1,3 @@ +QT += declarative +SOURCES += main.cpp +HEADERS += imageviewer.h diff --git a/doc/src/snippets/declarative/qtbinding/newelements/standalone.qml b/doc/src/snippets/declarative/qtbinding/newelements/standalone.qml new file mode 100644 index 0000000..7345f21 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/newelements/standalone.qml @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +import MyLibrary 1.0 + +ImageViewer { image: "smile.png" } +//![0] diff --git a/doc/src/snippets/declarative/qtbinding/properties-cpp/MyItem.qml b/doc/src/snippets/declarative/qtbinding/properties-cpp/MyItem.qml new file mode 100644 index 0000000..9db4b93 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/properties-cpp/MyItem.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// MyItem.qml +import QtQuick 1.0 + +Rectangle { + width: 100; height: 100 + color: applicationData.backgroundColor + + MouseArea { + anchors.fill: parent + onClicked: applicationData.backgroundColor = "red" + } +} +//![0] + diff --git a/doc/src/snippets/declarative/qtbinding/properties-cpp/applicationdata.h b/doc/src/snippets/declarative/qtbinding/properties-cpp/applicationdata.h new file mode 100644 index 0000000..763a451 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/properties-cpp/applicationdata.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +//![0] +class ApplicationData : public QObject +{ + Q_OBJECT + Q_PROPERTY(QColor backgroundColor + READ backgroundColor + WRITE setBackgroundColor + NOTIFY backgroundColorChanged) + +public: + void setBackgroundColor(const QColor &c) { + if (c != m_color) { + m_color = c; + emit backgroundColorChanged(); + } + } + + QColor backgroundColor() const { + return m_color; + } + +signals: + void backgroundColorChanged(); + +private: + QColor m_color; +}; +//![0] diff --git a/doc/src/snippets/declarative/qtbinding/properties-cpp/main.cpp b/doc/src/snippets/declarative/qtbinding/properties-cpp/main.cpp new file mode 100644 index 0000000..36b508d --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/properties-cpp/main.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +#include "applicationdata.h" + +int main(int argc, char *argv[]) { + QApplication app(argc, argv); + + QDeclarativeView view; + + ApplicationData data; + view.rootContext()->setContextProperty("applicationData", &data); + + view.setSource(QUrl::fromLocalFile("MyItem.qml")); + view.show(); + + return app.exec(); +} + diff --git a/doc/src/snippets/declarative/qtbinding/properties-cpp/properties-cpp.pro b/doc/src/snippets/declarative/qtbinding/properties-cpp/properties-cpp.pro new file mode 100644 index 0000000..188a9fb --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/properties-cpp/properties-cpp.pro @@ -0,0 +1,3 @@ +QT += declarative +SOURCES += main.cpp +HEADERS += applicationdata.h diff --git a/doc/src/snippets/declarative/qtbinding/properties-qml/MyItem.qml b/doc/src/snippets/declarative/qtbinding/properties-qml/MyItem.qml new file mode 100644 index 0000000..a43ded8 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/properties-qml/MyItem.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// MyItem.qml +import QtQuick 1.0 + +Item { + property int someNumber: 100 +} +//![0] diff --git a/doc/src/snippets/declarative/qtbinding/properties-qml/main.cpp b/doc/src/snippets/declarative/qtbinding/properties-qml/main.cpp new file mode 100644 index 0000000..d8daff8 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/properties-qml/main.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + +//![0] +QDeclarativeEngine engine; +QDeclarativeComponent component(&engine, "MyItem.qml"); +QObject *object = component.create(); + +qDebug() << "Property value:" << QDeclarativeProperty::read(object, "someNumber").toInt(); +QDeclarativeProperty::write(object, "someNumber", 5000); + +qDebug() << "Property value:" << object->property("someNumber").toInt(); +object->setProperty("someNumber", 100); +//![0] + + return app.exec(); +} + diff --git a/doc/src/snippets/declarative/qtbinding/properties-qml/properties-qml.pro b/doc/src/snippets/declarative/qtbinding/properties-qml/properties-qml.pro new file mode 100644 index 0000000..68eeaf2 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/properties-qml/properties-qml.pro @@ -0,0 +1,2 @@ +QT += declarative +SOURCES += main.cpp diff --git a/doc/src/snippets/declarative/qtbinding/resources/main.qml b/doc/src/snippets/declarative/qtbinding/resources/main.qml index 644d963..43029cf 100644 --- a/doc/src/snippets/declarative/qtbinding/resources/main.qml +++ b/doc/src/snippets/declarative/qtbinding/resources/main.qml @@ -39,9 +39,8 @@ ****************************************************************************/ //![0] +// main.qml import QtQuick 1.0 -Image { - source: "images/background.png" -} +Image { source: "images/background.png" } //![0] diff --git a/doc/src/snippets/declarative/qtbinding/signals-cpp/MyItem.qml b/doc/src/snippets/declarative/qtbinding/signals-cpp/MyItem.qml new file mode 100644 index 0000000..d900830 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/signals-cpp/MyItem.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// MyItem.qml +import QtQuick 1.0 + +Item { + Connections { + target: imageViewer + onImageChanged: console.log("Image has changed!") + } +} +//![0] diff --git a/doc/src/snippets/declarative/qtbinding/signals-cpp/imageviewer.h b/doc/src/snippets/declarative/qtbinding/signals-cpp/imageviewer.h new file mode 100644 index 0000000..7288d11 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/signals-cpp/imageviewer.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +//![start] +class ImageViewer : public QDeclarativeItem +{ + Q_OBJECT + Q_PROPERTY(QUrl image READ image WRITE setImage NOTIFY imageChanged) +public: +//![start] + ImageViewer(QDeclarativeItem *item = 0); + + void setImage(const QUrl &url) {} + QUrl image() const { return QUrl(); } + +public slots: + void emitSignals(); + +//![end] +signals: + void imageChanged(); + void loadingError(const QString &errorMsg); +}; +//![end] + diff --git a/doc/src/snippets/declarative/qtbinding/signals-cpp/main.cpp b/doc/src/snippets/declarative/qtbinding/signals-cpp/main.cpp new file mode 100644 index 0000000..e5dd33c --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/signals-cpp/main.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +#include "imageviewer.h" + + +ImageViewer::ImageViewer(QDeclarativeItem *item) + : QDeclarativeItem(item) +{ + QTimer::singleShot(0, this, SLOT(emitSignals())); +} + +void ImageViewer::emitSignals() +{ + emit imageChanged(); + emit loadingError("some error message"); +} + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + qmlRegisterType("MyLibrary", 1, 0, "ImageViewer"); + + QDeclarativeView standalone; + standalone.setSource(QUrl::fromLocalFile("standalone.qml")); + standalone.show(); + +//![connections] +ImageViewer viewer; + +QDeclarativeView view; +view.rootContext()->setContextProperty("imageViewer", &viewer); + +view.setSource(QUrl::fromLocalFile("MyItem.qml")); +view.show(); +//![connections] + + return app.exec(); +} + + diff --git a/doc/src/snippets/declarative/qtbinding/signals-cpp/signals-cpp.pro b/doc/src/snippets/declarative/qtbinding/signals-cpp/signals-cpp.pro new file mode 100644 index 0000000..9aa8702 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/signals-cpp/signals-cpp.pro @@ -0,0 +1,3 @@ +QT += declarative +SOURCES += main.cpp +HEADERS += "imageviewer.h" diff --git a/doc/src/snippets/declarative/qtbinding/signals-cpp/standalone.qml b/doc/src/snippets/declarative/qtbinding/signals-cpp/standalone.qml new file mode 100644 index 0000000..4027b19 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/signals-cpp/standalone.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +import MyLibrary 1.0 + +//![0] +ImageViewer { + onImageChanged: console.log("Image changed!") + onLoadingError: console.log("Image failed to load:", errorMsg) +} +//![0] + diff --git a/doc/src/snippets/declarative/qtbinding/signals-qml/MyItem.qml b/doc/src/snippets/declarative/qtbinding/signals-qml/MyItem.qml new file mode 100644 index 0000000..e4b6ced --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/signals-qml/MyItem.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// MyItem.qml +import QtQuick 1.0 + +Item { + id: item + width: 100; height: 100 + + signal qmlSignal(string msg) + + MouseArea { + anchors.fill: parent + onClicked: item.qmlSignal("Hello from QML") + } +} +//![0] diff --git a/doc/src/snippets/declarative/qtbinding/signals-qml/main.cpp b/doc/src/snippets/declarative/qtbinding/signals-qml/main.cpp new file mode 100644 index 0000000..f1d03c4 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/signals-qml/main.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +//![0] +int main(int argc, char *argv[]) { + QApplication app(argc, argv); + + QDeclarativeView view(QUrl::fromLocalFile("MyItem.qml")); + QObject *item = view.rootObject(); + + MyClass myClass; + QObject::connect(item, SIGNAL(qmlSignal(QString)), + &myClass, SLOT(cppSlot(QString))); + + view.show(); + return app.exec(); +} +//![0] + +#include "moc_main.cpp" diff --git a/doc/src/snippets/declarative/qtbinding/signals-qml/myclass.h b/doc/src/snippets/declarative/qtbinding/signals-qml/myclass.h new file mode 100644 index 0000000..c326a54 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/signals-qml/myclass.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +//![0] +class MyClass : public QObject +{ + Q_OBJECT +public slots: + void cppSlot(const QString &msg) { + qDebug() << "Called the C++ slot with message:" << msg; + } +}; +//![0] diff --git a/doc/src/snippets/declarative/qtbinding/signals-qml/signals-qml.pro b/doc/src/snippets/declarative/qtbinding/signals-qml/signals-qml.pro new file mode 100644 index 0000000..01066c1 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/signals-qml/signals-qml.pro @@ -0,0 +1,3 @@ +QT += declarative +SOURCES += main.cpp +HEADERS += myclass.h diff --git a/doc/src/snippets/declarative/qtbinding/stopwatch/main.cpp b/doc/src/snippets/declarative/qtbinding/stopwatch/main.cpp deleted file mode 100644 index 12481da..0000000 --- a/doc/src/snippets/declarative/qtbinding/stopwatch/main.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stopwatch.h" - -#include -#include -#include - -//![0] -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QDeclarativeView view; - view.rootContext()->setContextProperty("stopwatch", - new Stopwatch); - - view.setSource(QUrl::fromLocalFile("main.qml")); - view.show(); - - return app.exec(); -} -//![0] - diff --git a/doc/src/snippets/declarative/qtbinding/stopwatch/main.qml b/doc/src/snippets/declarative/qtbinding/stopwatch/main.qml deleted file mode 100644 index f894f71..0000000 --- a/doc/src/snippets/declarative/qtbinding/stopwatch/main.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -import QtQuick 1.0 - -Rectangle { - width: 300 - height: 300 - - MouseArea { - anchors.fill: parent - onClicked: { - if (stopwatch.isRunning()) - stopwatch.stop() - else - stopwatch.start(); - } - } -} -//![0] diff --git a/doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.cpp b/doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.cpp deleted file mode 100644 index 124422f..0000000 --- a/doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stopwatch.h" - -Stopwatch::Stopwatch() - : m_running(false) -{ -} - -bool Stopwatch::isRunning() const -{ - return m_running; -} - -void Stopwatch::start() -{ - m_running = true; -} - -void Stopwatch::stop() -{ - m_running = false; -} - diff --git a/doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.h b/doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.h deleted file mode 100644 index fd65916..0000000 --- a/doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -//![0] -class Stopwatch : public QObject -{ - Q_OBJECT -public: - Stopwatch(); - - Q_INVOKABLE bool isRunning() const; - -public slots: - void start(); - void stop(); - -private: - bool m_running; -}; - -//![0] - diff --git a/doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.pro b/doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.pro deleted file mode 100644 index d803e6a..0000000 --- a/doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.pro +++ /dev/null @@ -1,3 +0,0 @@ -QT += declarative -HEADERS += stopwatch.h -SOURCES += main.cpp stopwatch.cpp diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 0a2a6db..2686ce3 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -98,6 +98,43 @@ class QByteArray; int width = item->width(); // width = 200 \endcode + + \section2 Network Components + + If the URL passed to QDeclarativeComponent is a network resource, or if the QML document references a + network resource, the QDeclarativeComponent has to fetch the network data before it is able to create + objects. In this case, the QDeclarativeComponent will have a \l {QDeclarativeComponent::Loading}{Loading} + \l {QDeclarativeComponent::status()}{status}. An application will have to wait until the component + is \l {QDeclarativeComponent::Ready}{Ready} before calling \l {QDeclarativeComponent::create()}. + + The following example shows how to load a QML file from a network resource. After creating + the QDeclarativeComponent, it tests whether the component is loading. If it is, it connects to the + QDeclarativeComponent::statusChanged() signal and otherwise calls the \c {continueLoading()} method + directly. Note that QDeclarativeComponent::isLoading() may be false for a network component if the + component has been cached and is ready immediately. + + \code + MyApplication::MyApplication() + { + // ... + component = new QDeclarativeComponent(engine, QUrl("http://www.example.com/main.qml")); + if (component->isLoading()) + QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), + this, SLOT(continueLoading())); + else + continueLoading(); + } + + void MyApplication::continueLoading() + { + if (component->isError()) { + qWarning() << component->errors(); + } else { + QObject *myObject = component->create(); + } + } + \endcode + \sa {Using QML in C++ Applications}, {Integrating QML with existing Qt UI code} */ diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index 59d5cfa..1e58a71 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -86,9 +86,14 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() QDeclarativeComponent component(&engine); component.setData("import QtQuick 1.0\nListView { model: myModel }", QUrl()); - component.create(context); + QObject *window = component.create(context); \endcode + Note it is the responsibility of the creator to delete any QDeclarativeContext it + constructs. If the \c context object in the example is no longer needed when the + \c window component instance is destroyed, the \c context must be destroyed explicitly. + The simplest way to ensure this is to set \c window as the parent of \c context. + To simplify binding and maintaining larger data sets, a context object can be set on a QDeclarativeContext. All the properties of the context object are available by name in the context, as though they were all individually added through calls @@ -119,11 +124,13 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() All properties added explicitly by QDeclarativeContext::setContextProperty() take precedence over the context object's properties. - Contexts form a hierarchy. The root of this hierarchy is the QDeclarativeEngine's - \l {QDeclarativeEngine::rootContext()}{root context}. A component instance can - access the data in its own context, as well as all its ancestor contexts. Data - can be made available to all instances by modifying the - \l {QDeclarativeEngine::rootContext()}{root context}. + \section2 The Context Hierarchy + + Contexts form a hierarchy. The root of this hierarchy is the QML engine's + \l {QDeclarativeEngine::rootContext()}{root context}. Child contexts inherit + the context properties of their parents; if a child context sets a context property + that already exists in its parent, the new context property overrides that of the + parent. The following example defines two contexts - \c context1 and \c context2. The second context overrides the "b" context property inherited from the first with a @@ -144,7 +151,7 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() context, their bindings are. If a context is destroyed, the property bindings of outstanding QML objects will stop evaluating. - \note Setting the context object or adding new context properties after an object + \warning Setting the context object or adding new context properties after an object has been created in that context is an expensive operation (essentially forcing all bindings to reevaluate). Thus whenever possible you should complete "setup" of the context before using it to create any objects. diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index cff0b46..0c7f8fb 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -86,6 +86,7 @@ tst_examples::tst_examples() // Add directories you want excluded here excludedDirs << "doc/src/snippets/declarative/visualdatamodel_rootindex"; + excludedDirs << "doc/src/snippets/declarative/qtbinding"; #ifdef QT_NO_WEBKIT excludedDirs << "examples/declarative/modelviews/webview"; -- cgit v0.12 From eedb9980c89e77e21e1336195930a148b6a2e712 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 4 Nov 2010 16:05:30 +1000 Subject: Fix errors in example code. Also reverts the example code to the old list format. Task-number: QTBUG-14871 --- src/declarative/graphicsitems/qdeclarativeimage.cpp | 16 +++++++++------- src/declarative/graphicsitems/qdeclarativeloader.cpp | 16 +++++++++------- src/declarative/util/qdeclarativefontloader.cpp | 16 +++++++++------- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 08d237f..1f1e93d 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -288,23 +288,25 @@ qreal QDeclarativeImage::paintedHeight() const Use this status to provide an update or respond to the status change in some way. For example, you could: - \e {Trigger a state change:} - \qml - State { name: 'loaded'; when: image.status = Image.Ready } + \list + \o Trigger a state change: + \qml + State { name: 'loaded'; when: image.status == Image.Ready } \endqml - \e {Implement an \c onStatusChanged signal handler:} - \qml + \o Implement an \c onStatusChanged signal handler: + \qml Image { id: image onStatusChanged: if (image.status == Image.Ready) console.log('Loaded') } \endqml - \e {Bind to the status value:} + \o Bind to the status value: \qml - Text { text: image.status != Image.Ready ? 'Not Loaded' : 'Loaded' } + Text { text: image.status == Image.Ready ? 'Loaded' : 'Not loaded' } \endqml + \endlist \sa progress */ diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 7777567..109fbbb 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -395,23 +395,25 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded() Use this status to provide an update or respond to the status change in some way. For example, you could: - \e {Trigger a state change:} - \qml - State { name: 'loaded'; when: loader.status = Loader.Ready } + \list + \o Trigger a state change: + \qml + State { name: 'loaded'; when: loader.status == Loader.Ready } \endqml - \e {Implement an \c onStatusChanged signal handler:} - \qml + \o Implement an \c onStatusChanged signal handler: + \qml Loader { id: loader onStatusChanged: if (loader.status == Loader.Ready) console.log('Loaded') } \endqml - \e {Bind to the status value:} + \o Bind to the status value: \qml - Text { text: loader.status != Loader.Ready ? 'Not Loaded' : 'Loaded' } + Text { text: loader.status == Loader.Ready ? 'Loaded' : 'Not loaded' } \endqml + \endlist Note that if the source is a local file, the status will initially be Ready (or Error). While there will be no onStatusChanged signal in that case, the onLoaded will still be invoked. diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp index 9fee257..03a0561 100644 --- a/src/declarative/util/qdeclarativefontloader.cpp +++ b/src/declarative/util/qdeclarativefontloader.cpp @@ -297,23 +297,25 @@ void QDeclarativeFontLoader::setName(const QString &name) Use this status to provide an update or respond to the status change in some way. For example, you could: - \e {Trigger a state change:} - \qml - State { name: 'loaded'; when: loader.status = FontLoader.Ready } + \list + \o Trigger a state change: + \qml + State { name: 'loaded'; when: loader.status == FontLoader.Ready } \endqml - \e {Implement an \c onStatusChanged signal handler:} - \qml + \o Implement an \c onStatusChanged signal handler: + \qml FontLoader { id: loader onStatusChanged: if (loader.status == FontLoader.Ready) console.log('Loaded') } \endqml - \e {Bind to the status value:} + \o Bind to the status value: \qml - Text { text: loader.status != FontLoader.Ready ? 'Not Loaded' : 'Loaded' } + Text { text: loader.status == FontLoader.Ready ? 'Loaded' : 'Not loaded' } \endqml + \endlist */ QDeclarativeFontLoader::Status QDeclarativeFontLoader::status() const { -- cgit v0.12