From 926155a45d40ba38f1f525751708d89438477bb9 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 1 Mar 2010 14:51:29 +1000 Subject: Fix reload() when keys are not specified, and add extra tests. --- src/declarative/util/qdeclarativexmllistmodel.cpp | 21 +++- .../tst_qdeclarativexmllistmodel.cpp | 130 ++++++++++++++------- 2 files changed, 108 insertions(+), 43 deletions(-) diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 386df46..162a669 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -709,8 +709,24 @@ void QDeclarativeXmlListModel::reload() d->qmlXmlQuery.abort(); d->queryId = -1; - if (d->size < 0) + int count = d->size; + if (count < 0) d->size = 0; + bool hasKeys = false; + for (int i=0; iroleObjects.count(); i++) { + if (d->roleObjects[i]->isKey()) { + hasKeys = true; + break; + } + } + if (!hasKeys) { + d->data.clear(); + d->size = 0; + if (count > 0) { + emit itemsRemoved(0, count); + emit countChanged(); + } + } if (d->src.isEmpty() && d->xml.isEmpty()) return; @@ -782,9 +798,10 @@ void QDeclarativeXmlListModel::queryCompleted(int id, int size) d->data = d->qmlXmlQuery.modelData(); QList removed = d->qmlXmlQuery.removedItemRanges(); + QList inserted = d->qmlXmlQuery.insertedItemRanges(); + for (int i=0; i inserted = d->qmlXmlQuery.insertedItemRanges(); for (int i=0; i(component.create()); - QVERIFY(listModel != 0); - QTRY_COMPARE(listModel->count(), 9); + QDeclarativeXmlListModel *model = qobject_cast(component.create()); + QVERIFY(model != 0); + QTRY_COMPARE(model->count(), 9); QList roles; roles << Qt::UserRole << Qt::UserRole + 1 << Qt::UserRole + 2 << Qt::UserRole + 3; - QHash data = listModel->data(3, roles); + QHash data = model->data(3, roles); QVERIFY(data.count() == 4); QCOMPARE(data.value(Qt::UserRole).toString(), QLatin1String("Spot")); QCOMPARE(data.value(Qt::UserRole+1).toString(), QLatin1String("Dog")); QCOMPARE(data.value(Qt::UserRole+2).toInt(), 9); QCOMPARE(data.value(Qt::UserRole+3).toString(), QLatin1String("Medium")); - delete listModel; + delete model; } void tst_qdeclarativexmllistmodel::missingFields() { QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model2.qml")); - QDeclarativeXmlListModel *listModel = qobject_cast(component.create()); - QVERIFY(listModel != 0); - QTRY_COMPARE(listModel->count(), 9); + QDeclarativeXmlListModel *model = qobject_cast(component.create()); + QVERIFY(model != 0); + QTRY_COMPARE(model->count(), 9); QList roles; roles << Qt::UserRole << Qt::UserRole + 1 << Qt::UserRole + 2 << Qt::UserRole + 3 << Qt::UserRole + 4; - QHash data = listModel->data(5, roles); + QHash data = model->data(5, roles); QVERIFY(data.count() == 5); QCOMPARE(data.value(Qt::UserRole+3).toString(), QLatin1String("")); QCOMPARE(data.value(Qt::UserRole+4).toString(), QLatin1String("")); - data = listModel->data(7, roles); + data = model->data(7, roles); QVERIFY(data.count() == 5); QCOMPARE(data.value(Qt::UserRole+2).toString(), QLatin1String("")); - delete listModel; + delete model; } void tst_qdeclarativexmllistmodel::cdata() { QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/recipes.qml")); - QDeclarativeXmlListModel *listModel = qobject_cast(component.create()); - QVERIFY(listModel != 0); - QTRY_COMPARE(listModel->count(), 5); + QDeclarativeXmlListModel *model = qobject_cast(component.create()); + QVERIFY(model != 0); + QTRY_COMPARE(model->count(), 5); QList roles; roles << Qt::UserRole + 2; - QHash data = listModel->data(2, roles); + QHash data = model->data(2, roles); QVERIFY(data.count() == 1); QVERIFY(data.value(Qt::UserRole+2).toString().startsWith(QLatin1String(""))); - delete listModel; + delete model; } void tst_qdeclarativexmllistmodel::attributes() { QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/recipes.qml")); - QDeclarativeXmlListModel *listModel = qobject_cast(component.create()); - QVERIFY(listModel != 0); - QTRY_COMPARE(listModel->count(), 5); + QDeclarativeXmlListModel *model = qobject_cast(component.create()); + QVERIFY(model != 0); + QTRY_COMPARE(model->count(), 5); QList roles; roles << Qt::UserRole; - QHash data = listModel->data(2, roles); + QHash data = model->data(2, roles); QVERIFY(data.count() == 1); QCOMPARE(data.value(Qt::UserRole).toString(), QLatin1String("Vegetable Soup")); - delete listModel; + delete model; } void tst_qdeclarativexmllistmodel::roles() { QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); - QDeclarativeXmlListModel *listModel = qobject_cast(component.create()); - QVERIFY(listModel != 0); - QTRY_COMPARE(listModel->count(), 9); + QDeclarativeXmlListModel *model = qobject_cast(component.create()); + QVERIFY(model != 0); + QTRY_COMPARE(model->count(), 9); - QList roles = listModel->roles(); + QList roles = model->roles(); QCOMPARE(roles.count(), 4); - QCOMPARE(listModel->toString(roles.at(0)), QLatin1String("name")); - QCOMPARE(listModel->toString(roles.at(1)), QLatin1String("type")); - QCOMPARE(listModel->toString(roles.at(2)), QLatin1String("age")); - QCOMPARE(listModel->toString(roles.at(3)), QLatin1String("size")); + QCOMPARE(model->toString(roles.at(0)), QLatin1String("name")); + QCOMPARE(model->toString(roles.at(1)), QLatin1String("type")); + QCOMPARE(model->toString(roles.at(2)), QLatin1String("age")); + QCOMPARE(model->toString(roles.at(3)), QLatin1String("size")); - delete listModel; + delete model; } void tst_qdeclarativexmllistmodel::roleErrors() @@ -207,13 +208,13 @@ void tst_qdeclarativexmllistmodel::roleErrors() QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleErrors.qml")); QTest::ignoreMessage(QtWarningMsg, QString("QML XmlRole (" + QUrl::fromLocalFile(SRCDIR "/data/roleErrors.qml").toString() + ":6:5) An XmlRole query must not start with '/'").toUtf8().constData()); //### make sure we receive all expected warning messages. - QDeclarativeXmlListModel *listModel = qobject_cast(component.create()); - QVERIFY(listModel != 0); - QTRY_COMPARE(listModel->count(), 9); + QDeclarativeXmlListModel *model = qobject_cast(component.create()); + QVERIFY(model != 0); + QTRY_COMPARE(model->count(), 9); QList roles; roles << Qt::UserRole << Qt::UserRole + 1 << Qt::UserRole + 2 << Qt::UserRole + 3; - QHash data = listModel->data(3, roles); + QHash data = model->data(3, roles); QVERIFY(data.count() == 4); //### should any of these return valid values? @@ -224,21 +225,47 @@ void tst_qdeclarativexmllistmodel::roleErrors() QEXPECT_FAIL("", "QT-2456", Continue); QCOMPARE(data.value(Qt::UserRole+3), QVariant()); - delete listModel; + delete model; } void tst_qdeclarativexmllistmodel::uniqueRoleNames() { QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/unique.qml")); QTest::ignoreMessage(QtWarningMsg, QString("QML XmlRole (" + QUrl::fromLocalFile(SRCDIR "/data/unique.qml").toString() + ":7:5) \"name\" duplicates a previous role name and will be disabled.").toUtf8().constData()); - QDeclarativeXmlListModel *listModel = qobject_cast(component.create()); - QVERIFY(listModel != 0); - QTRY_COMPARE(listModel->count(), 9); + QDeclarativeXmlListModel *model = qobject_cast(component.create()); + QVERIFY(model != 0); + QTRY_COMPARE(model->count(), 9); - QList roles = listModel->roles(); + QList roles = model->roles(); QCOMPARE(roles.count(), 1); - delete listModel; + delete model; +} + +void tst_qdeclarativexmllistmodel::reload() +{ + // If no keys are used, the model should be rebuilt from scratch when + // reload() is called. + + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); + QDeclarativeXmlListModel *model = qobject_cast(component.create()); + QVERIFY(model != 0); + QTRY_COMPARE(model->count(), 9); + + QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int))); + QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int))); + QSignalSpy spyCount(model, SIGNAL(countChanged())); + + model->reload(); + QTRY_COMPARE(spyCount.count(), 1); + QTRY_COMPARE(spyInsert.count(), 1); + QTRY_COMPARE(spyRemove.count(), 1); + + QCOMPARE(spyInsert[0][0].toInt(), 0); + QCOMPARE(spyInsert[0][1].toInt(), 9); + + QCOMPARE(spyRemove[0][0].toInt(), 0); + QCOMPARE(spyRemove[0][1].toInt(), 9); } void tst_qdeclarativexmllistmodel::useKeys() @@ -368,12 +395,33 @@ void tst_qdeclarativexmllistmodel::useKeys_data() << (QList() << qMakePair(0, 1)) << (QList() << qMakePair(0, 1)); - QTest::newRow("add and remove simultaneously") + QTest::newRow("add and remove simultaneously, in different spots") << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf") << 4 << makeItemXmlAndData("name=B,age=35,sport=Athletics;name=E,age=65,sport=Fencing", &modelData) << modelData << (QList() << qMakePair(1, 1)) << (QList() << qMakePair(0, 1) << qMakePair(2,2)); + + QTest::newRow("insert at start, remove at end i.e. rss feed") + << makeItemXmlAndData("name=C,age=45,sport=Curling;name=D,age=55,sport=Golf;name=E,age=65,sport=Fencing") << 3 + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling", &modelData) + << modelData + << (QList() << qMakePair(0, 2)) + << (QList() << qMakePair(1, 2)); + + QTest::newRow("remove at start, insert at end") + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling") << 3 + << makeItemXmlAndData("name=C,age=45,sport=Curling;name=D,age=55,sport=Golf;name=E,age=65,sport=Fencing", &modelData) + << modelData + << (QList() << qMakePair(1, 2)) + << (QList() << qMakePair(0, 2)); + + QTest::newRow("all data has changed") + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35") << 2 + << makeItemXmlAndData("name=C,age=45,sport=Curling;name=D,age=55,sport=Golf", &modelData) + << modelData + << (QList() << qMakePair(0, 2)) + << (QList() << qMakePair(0, 2)); } void tst_qdeclarativexmllistmodel::noKeysValueChanges() -- cgit v0.12 From 8095b3074a47ff317cafdce5e8a8f955bf8c97fa Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 1 Mar 2010 14:57:51 +1000 Subject: Make compile following QDeclarativePropertyChanges. --- .../tst_qdeclarativeproperty.cpp | 56 +++++++++++----------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp index a3aefe3..c72c9e7 100644 --- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp +++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp @@ -466,7 +466,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() } { - QDeclarativeMetaProperty prop(&dobject, QString("onPropertyWithNotifyChanged")); + QDeclarativeProperty prop(&dobject, QString("onPropertyWithNotifyChanged")); QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); binding->setTarget(prop); @@ -488,7 +488,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifier(obj, -1), false); QCOMPARE(QString(prop.method().signature()), QString("oddlyNamedNotifySignal()")); - QCOMPARE(prop.type(), QDeclarativeMetaProperty::SignalProperty); + QCOMPARE(prop.type(), QDeclarativeProperty::SignalProperty); QCOMPARE(prop.isProperty(), false); QCOMPARE(prop.isDefault(), false); QCOMPARE(prop.isWritable(), false); @@ -496,19 +496,19 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression != 0); - QVERIFY(prop.signalExpression() == expression); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()")); - QCOMPARE(prop.valueTypeCoreIndex(), -1); + QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; } @@ -764,7 +764,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() } { - QDeclarativeMetaProperty prop(&dobject, QString("onPropertyWithNotifyChanged"), engine.rootContext()); + QDeclarativeProperty prop(&dobject, QString("onPropertyWithNotifyChanged"), engine.rootContext()); QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); binding->setTarget(prop); @@ -786,7 +786,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifier(obj, -1), false); QCOMPARE(QString(prop.method().signature()), QString("oddlyNamedNotifySignal()")); - QCOMPARE(prop.type(), QDeclarativeMetaProperty::SignalProperty); + QCOMPARE(prop.type(), QDeclarativeProperty::SignalProperty); QCOMPARE(prop.isProperty(), false); QCOMPARE(prop.isDefault(), false); QCOMPARE(prop.isWritable(), false); @@ -794,19 +794,19 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression != 0); - QVERIFY(prop.signalExpression() == expression); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()")); - QCOMPARE(prop.valueTypeCoreIndex(), -1); + QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; } @@ -845,13 +845,13 @@ void tst_qdeclarativeproperty::name() { PropertyObject o; - QDeclarativeMetaProperty p(&o, "onPropertyWithNotifyChanged"); + QDeclarativeProperty p(&o, "onPropertyWithNotifyChanged"); QCOMPARE(p.name(), QString("onOddlyNamedNotifySignal")); } { QObject o; - QDeclarativeMetaProperty p(&o, "onPropertyWithNotifyChanged"); + QDeclarativeProperty p(&o, "onPropertyWithNotifyChanged"); QCOMPARE(p.name(), QString()); } @@ -948,11 +948,11 @@ void tst_qdeclarativeproperty::read() // Automatic signal property { PropertyObject o; - QDeclarativeMetaProperty p(&o, "onPropertyWithNotifyChanged"); + QDeclarativeProperty p(&o, "onPropertyWithNotifyChanged"); QCOMPARE(p.read(), QVariant()); - QVERIFY(0 == p.setSignalExpression(new QDeclarativeExpression())); - QVERIFY(0 != p.signalExpression()); + QVERIFY(0 == QDeclarativePropertyPrivate::setSignalExpression(p, new QDeclarativeExpression())); + QVERIFY(0 != QDeclarativePropertyPrivate::signalExpression(p)); QCOMPARE(p.read(), QVariant()); } @@ -1066,15 +1066,15 @@ void tst_qdeclarativeproperty::write() // Automatic signal property { PropertyObject o; - QDeclarativeMetaProperty p(&o, "onPropertyWithNotifyChanged"); + QDeclarativeProperty p(&o, "onPropertyWithNotifyChanged"); QCOMPARE(p.write(QVariant("console.log(1921)")), false); - QVERIFY(0 == p.setSignalExpression(new QDeclarativeExpression())); - QVERIFY(0 != p.signalExpression()); + QVERIFY(0 == QDeclarativePropertyPrivate::setSignalExpression(p, new QDeclarativeExpression())); + QVERIFY(0 != QDeclarativePropertyPrivate::signalExpression(p)); QCOMPARE(p.write(QVariant("console.log(1921)")), false); - QVERIFY(0 != p.signalExpression()); + QVERIFY(0 != QDeclarativePropertyPrivate::signalExpression(p)); } // Value-type property @@ -1210,7 +1210,7 @@ void tst_qdeclarativeproperty::reset() // Automatic signal property { PropertyObject o; - QDeclarativeMetaProperty p(&o, "onPropertyWithNotifyChanged"); + QDeclarativeProperty p(&o, "onPropertyWithNotifyChanged"); QCOMPARE(p.isResettable(), false); QCOMPARE(p.reset(), false); -- cgit v0.12 From 1c9908d6d31326dbeed9d23b4f3ac3c8446d91b5 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 1 Mar 2010 15:34:59 +1000 Subject: Fix position of image in detail view in flickr-mobile --- demos/declarative/flickr/mobile/ImageDetails.qml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index 8749b4c..c51371c 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -66,10 +66,7 @@ Flipable { Image { id: bigImage; source: container.photoUrl; scale: slider.value - // Center image if it is smaller than the flickable area. - x: imageContainer.width > width*scale ? (imageContainer.width - width*scale) / 2 : 0 - y: imageContainer.height > height*scale ? (imageContainer.height - height*scale) / 2 : 0 - smooth: !flickable.moving + anchors.centerIn: parent; smooth: !flickable.moving onStatusChanged : { // Default scale shows the entire image. if (status == 1 && width != 0) { -- cgit v0.12 From bec22cbfb255da34afe99c4cec30fc13cc40d900 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 1 Mar 2010 16:30:29 +1000 Subject: Small optimizations. --- src/declarative/graphicsitems/qdeclarativeflickable_p_p.h | 6 ++++-- src/declarative/graphicsitems/qdeclarativeitem.cpp | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h index 1ff4f92..ad7a04d 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h @@ -134,8 +134,10 @@ public: Velocity(QDeclarativeFlickablePrivate *p) : parent(p) {} virtual void setValue(qreal v) { - QDeclarativeTimeLineValue::setValue(v); - parent->updateVelocity(); + if (v != value()) { + QDeclarativeTimeLineValue::setValue(v); + parent->updateVelocity(); + } } QDeclarativeFlickablePrivate *parent; }; diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index c282808..f48c761 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1730,8 +1730,12 @@ void QDeclarativeItem::geometryChanged(const QRectF &newGeometry, if (d->_anchors) d->_anchors->d_func()->updateMe(); - if (transformOrigin() != QDeclarativeItem::TopLeft) - setTransformOriginPoint(d->computeTransformOrigin()); + if (transformOrigin() != QDeclarativeItem::TopLeft + && (newGeometry.width() != oldGeometry.width() || newGeometry.height() != oldGeometry.height())) { + QPointF origin = d->computeTransformOrigin(); + if (transformOriginPoint() != origin) + setTransformOriginPoint(origin); + } if (newGeometry.x() != oldGeometry.x()) emit xChanged(); -- cgit v0.12 From d5449c3cc85624b50e6a6fcabc6ad96b79d4bd0a Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 1 Mar 2010 16:31:32 +1000 Subject: Keep image centered in ImageDetails. --- demos/declarative/flickr/mobile/ImageDetails.qml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index 8749b4c..55061db 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -66,9 +66,7 @@ Flipable { Image { id: bigImage; source: container.photoUrl; scale: slider.value - // Center image if it is smaller than the flickable area. - x: imageContainer.width > width*scale ? (imageContainer.width - width*scale) / 2 : 0 - y: imageContainer.height > height*scale ? (imageContainer.height - height*scale) / 2 : 0 + anchors.centerIn: parent smooth: !flickable.moving onStatusChanged : { // Default scale shows the entire image. -- cgit v0.12 From 32cdbb6de84eab0c3619d36f3091e68e93caf3e9 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 1 Mar 2010 19:11:41 +1000 Subject: use ParentAnimation --- examples/declarative/package/Delegate.qml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/examples/declarative/package/Delegate.qml b/examples/declarative/package/Delegate.qml index 4109633..62198d0 100644 --- a/examples/declarative/package/Delegate.qml +++ b/examples/declarative/package/Delegate.qml @@ -2,24 +2,26 @@ import Qt 4.6 //![0] Package { - Text { id: listDelegate; width: 200; height: 25; text: "Empty"; Package.name: "list" } - Text { id: gridDelegate; width: 100; height: 50; text: "Empty"; Package.name: "grid" } + Text { id: listDelegate; width: 200; height: 25; text: 'Empty'; Package.name: 'list' } + Text { id: gridDelegate; width: 100; height: 50; text: 'Empty'; Package.name: 'grid' } Rectangle { id: wrapper width: 200; height: 25 - color: "lightsteelblue" + color: 'lightsteelblue' + Text { text: display; anchors.centerIn: parent } MouseRegion { anchors.fill: parent onClicked: { - if (wrapper.state == "inList") - wrapper.state = "inGrid"; + if (wrapper.state == 'inList') + wrapper.state = 'inGrid'; else - wrapper.state = "inList"; + wrapper.state = 'inList'; } } - state: "inList" + + state: 'inList' states: [ State { name: 'inList' @@ -27,15 +29,17 @@ Package { }, State { name: 'inGrid' - ParentChange { target: wrapper; parent: gridDelegate } - PropertyChanges { target: wrapper; x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height } + ParentChange { + target: wrapper; parent: gridDelegate + x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height + } } ] + transitions: [ Transition { - SequentialAnimation { - ParentAction { target: wrapper } - NumberAnimation { targets: wrapper; properties: 'x,y,width,height'; duration: 300 } + ParentAnimation { + NumberAnimation { properties: 'x,y,width,height'; duration: 300 } } } ] -- cgit v0.12 From 3a4dc08d08ce0388dd183a24923871e3e03ba531 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 1 Mar 2010 12:23:15 +0100 Subject: Make Minehunt demo compile. It still isn't working though. Investigations continue. Task-number: QTBUG-8549 --- demos/declarative/minehunt/main.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/demos/declarative/minehunt/main.cpp b/demos/declarative/minehunt/main.cpp index 0e99731..37dc8a5 100644 --- a/demos/declarative/minehunt/main.cpp +++ b/demos/declarative/minehunt/main.cpp @@ -100,8 +100,8 @@ public: MyWidget(int = 370, int = 480, QWidget *parent=0, Qt::WindowFlags flags=0); ~MyWidget(); - Q_PROPERTY(QList *tiles READ tiles CONSTANT); - QList *tiles() { return &_tiles; } + Q_PROPERTY(QDeclarativeListProperty tiles READ tiles CONSTANT); + QDeclarativeListProperty tiles() { return _tilesProperty; } Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged); bool isPlaying() {return playing;} @@ -116,8 +116,8 @@ public: int numFlags() const{return nFlags;} public slots: - Q_INVOKABLE void flip(int row, int col); - Q_INVOKABLE void flag(int row, int col); + Q_INVOKABLE bool flip(int row, int col); + Q_INVOKABLE bool flag(int row, int col); void setBoard(); void reset(); @@ -136,6 +136,7 @@ private: QDeclarativeView *canvas; QList _tiles; + QDeclarativeListProperty _tilesProperty; int numCols; int numRows; bool playing; @@ -145,6 +146,7 @@ private: int nFlags; }; +Q_DECLARE_METATYPE(QList) MyWidget::MyWidget(int width, int height, QWidget *parent, Qt::WindowFlags flags) : QWidget(parent, flags), canvas(0), numCols(9), numRows(9), playing(true), won(false) { @@ -155,7 +157,6 @@ MyWidget::MyWidget(int width, int height, QWidget *parent, Qt::WindowFlags flags for(int ii = 0; ii < numRows * numCols; ++ii) { _tiles << new Tile; } - reset(); QVBoxLayout *vbox = new QVBoxLayout; @@ -166,9 +167,10 @@ MyWidget::MyWidget(int width, int height, QWidget *parent, Qt::WindowFlags flags canvas->setFixedSize(width, height); vbox->addWidget(canvas); + _tilesProperty = QDeclarativeListProperty(this, _tiles); + QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->addDefaultObject(this); - ctxt->setContextProperty("tiles", QVariant::fromValue*>(&_tiles));//QTBUG-5675 canvas->setSource(QUrl::fromLocalFile(fileName)); } @@ -235,14 +237,14 @@ int MyWidget::getHint(int row, int col) return hint; } -void MyWidget::flip(int row, int col) +bool MyWidget::flip(int row, int col) { if(!playing) - return; + return false; Tile *t = tile(row, col); if (!t || t->hasFlag()) - return; + return false; if(t->flipped()){ int flags = 0; @@ -255,7 +257,7 @@ void MyWidget::flip(int row, int col) flags++; } if(!t->hint() || t->hint() != flags) - return; + return false; for (int c = col-1; c <= col+1; c++) for (int r = row-1; r <= row+1; r++) { Tile *nearT = tile(r, c); @@ -263,7 +265,7 @@ void MyWidget::flip(int row, int col) flip( r, c ); } } - return; + return true; } t->flip(); @@ -297,17 +299,19 @@ void MyWidget::flip(int row, int col) hasWonChanged(); setPlaying(false); } + return true; } -void MyWidget::flag(int row, int col) +bool MyWidget::flag(int row, int col) { Tile *t = tile(row, col); if(!t) - return; + return false; t->setHasFlag(!t->hasFlag()); nFlags += (t->hasFlag()?1:-1); emit numFlagsChanged(); + return true; } ///////////////////////////////////////////////////////// -- cgit v0.12 From bcb2ed5667bd957476e3b62ef3a479a26f1252f3 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 1 Mar 2010 13:02:13 +0100 Subject: Fix minehunt demo Game works again, and the issue with X11 native rendering being abysmally slow has been 'fixed'. --- demos/declarative/minehunt/main.cpp | 4 ++++ demos/declarative/minehunt/minehunt.qml | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/demos/declarative/minehunt/main.cpp b/demos/declarative/minehunt/main.cpp index 37dc8a5..e7a1d7c 100644 --- a/demos/declarative/minehunt/main.cpp +++ b/demos/declarative/minehunt/main.cpp @@ -317,6 +317,10 @@ bool MyWidget::flag(int row, int col) int main(int argc, char ** argv) { +#ifdef Q_WS_X11 + // native on X11 is terrible for this demo. + QApplication::setGraphicsSystem("raster"); +#endif QApplication app(argc, argv); bool frameless = false; diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 617a6ed..8a3cab1 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -31,7 +31,7 @@ Item { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter source: "pics/flag.png" - opacity: model.hasFlag + opacity: modelData.hasFlag opacity: Behavior { NumberAnimation { property: "opacity" @@ -47,16 +47,16 @@ Item { Text { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - text: model.hint + text: modelData.hint color: "white" font.bold: true - opacity: !model.hasMine && model.hint > 0 + opacity: !modelData.hasMine && modelData.hint > 0 } Image { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter source: "pics/bomb.png" - opacity: model.hasMine + opacity: modelData.hasMine } Explosion { id: expl @@ -65,7 +65,7 @@ Item { states: [ State { name: "back" - when: model.flipped + when: modelData.flipped PropertyChanges { target: flipable; angle: 180 } } ] @@ -81,7 +81,7 @@ Item { else ret = 0; if (ret > 0) { - if (model.hasMine && model.flipped) { + if (modelData.hasMine && modelData.flipped) { ret*3; } else { ret; @@ -96,7 +96,7 @@ Item { properties: "angle" } ScriptAction{ - script: if(model.hasMine && model.flipped){expl.explode = true;} + script: if(modelData.hasMine && modelData.flipped){expl.explode = true;} } } } -- cgit v0.12 From 4f77d4f1bebba1627700037bdfce4e74ad84cce8 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 1 Mar 2010 22:51:24 +1000 Subject: Make SameGame tutorials share images It's a bit of a waste to have four copies of all of the images. And as an advanced tutorial throwing in a minor complication like this is probably beneficial. Additionally, the background has been replaced by a smaller JPEG version. --- doc/src/declarative/advtutorial.qdoc | 5 +++++ .../declarative/tutorials/samegame/samegame1/Block.qml | 2 +- .../tutorials/samegame/samegame1/pics/background.png | Bin 313930 -> 0 bytes .../tutorials/samegame/samegame1/pics/redStone.png | Bin 2902 -> 0 bytes .../tutorials/samegame/samegame1/samegame.qml | 2 +- .../declarative/tutorials/samegame/samegame2/Block.qml | 2 +- .../tutorials/samegame/samegame2/pics/background.png | Bin 313930 -> 0 bytes .../tutorials/samegame/samegame2/pics/redStone.png | Bin 2902 -> 0 bytes .../tutorials/samegame/samegame2/samegame.qml | 2 +- .../declarative/tutorials/samegame/samegame3/Block.qml | 6 +++--- .../tutorials/samegame/samegame3/pics/background.png | Bin 313930 -> 0 bytes .../tutorials/samegame/samegame3/pics/blueStone.png | Bin 3054 -> 0 bytes .../tutorials/samegame/samegame3/pics/greenStone.png | Bin 2932 -> 0 bytes .../tutorials/samegame/samegame3/pics/redStone.png | Bin 2902 -> 0 bytes .../tutorials/samegame/samegame3/samegame.qml | 2 +- .../tutorials/samegame/samegame4/content/BoomBlock.qml | 12 ++++++------ .../samegame/samegame4/content/pics/background.png | Bin 313930 -> 0 bytes .../samegame/samegame4/content/pics/blueStar.png | Bin 278 -> 0 bytes .../samegame/samegame4/content/pics/blueStone.png | Bin 3054 -> 0 bytes .../samegame/samegame4/content/pics/greenStar.png | Bin 273 -> 0 bytes .../samegame/samegame4/content/pics/greenStone.png | Bin 2932 -> 0 bytes .../samegame/samegame4/content/pics/redStar.png | Bin 274 -> 0 bytes .../samegame/samegame4/content/pics/redStone.png | Bin 2902 -> 0 bytes .../tutorials/samegame/samegame4/content/pics/star.png | Bin 262 -> 0 bytes .../samegame/samegame4/content/pics/yellowStone.png | Bin 3056 -> 0 bytes .../tutorials/samegame/samegame4/samegame.qml | 2 +- .../tutorials/samegame/shared/pics/background.jpg | Bin 0 -> 36473 bytes .../tutorials/samegame/shared/pics/blueStar.png | Bin 0 -> 278 bytes .../tutorials/samegame/shared/pics/blueStone.png | Bin 0 -> 3054 bytes .../tutorials/samegame/shared/pics/greenStar.png | Bin 0 -> 273 bytes .../tutorials/samegame/shared/pics/greenStone.png | Bin 0 -> 2932 bytes .../tutorials/samegame/shared/pics/redStar.png | Bin 0 -> 274 bytes .../tutorials/samegame/shared/pics/redStone.png | Bin 0 -> 2902 bytes .../tutorials/samegame/shared/pics/star.png | Bin 0 -> 262 bytes .../tutorials/samegame/shared/pics/yellowStone.png | Bin 0 -> 3056 bytes 35 files changed, 20 insertions(+), 15 deletions(-) delete mode 100644 examples/declarative/tutorials/samegame/samegame1/pics/background.png delete mode 100644 examples/declarative/tutorials/samegame/samegame1/pics/redStone.png delete mode 100644 examples/declarative/tutorials/samegame/samegame2/pics/background.png delete mode 100644 examples/declarative/tutorials/samegame/samegame2/pics/redStone.png delete mode 100644 examples/declarative/tutorials/samegame/samegame3/pics/background.png delete mode 100644 examples/declarative/tutorials/samegame/samegame3/pics/blueStone.png delete mode 100644 examples/declarative/tutorials/samegame/samegame3/pics/greenStone.png delete mode 100644 examples/declarative/tutorials/samegame/samegame3/pics/redStone.png delete mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/background.png delete mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/blueStar.png delete mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/blueStone.png delete mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/greenStar.png delete mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/greenStone.png delete mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/redStar.png delete mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/redStone.png delete mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/star.png delete mode 100644 examples/declarative/tutorials/samegame/samegame4/content/pics/yellowStone.png create mode 100644 examples/declarative/tutorials/samegame/shared/pics/background.jpg create mode 100644 examples/declarative/tutorials/samegame/shared/pics/blueStar.png create mode 100644 examples/declarative/tutorials/samegame/shared/pics/blueStone.png create mode 100644 examples/declarative/tutorials/samegame/shared/pics/greenStar.png create mode 100644 examples/declarative/tutorials/samegame/shared/pics/greenStone.png create mode 100644 examples/declarative/tutorials/samegame/shared/pics/redStar.png create mode 100644 examples/declarative/tutorials/samegame/shared/pics/redStone.png create mode 100644 examples/declarative/tutorials/samegame/shared/pics/star.png create mode 100644 examples/declarative/tutorials/samegame/shared/pics/yellowStone.png diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index b7d964c..e420e6d 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -106,6 +106,11 @@ more than just an image. Note that we've set the image to be the size of the ite This will be used later, when we dynamically create and size the block items the image will be scaled automatically to the correct size. +Note that because there are several stages to this tutorial they share images. This is done by having a shared resources +folder containing the images, and all stages of the tutorial refer to the same shared folder. This is the reason for the +'../shared/pics' part of the image source. The image source can be any relative or absolute path, and it is relative to the +location of the file the Image element is in, with ../ meaning to go up one level. + You should be familiar with all that goes on in these files so far. This is a very basic start and doesn't move at all - next we will populate the game canvas with some blocks. diff --git a/examples/declarative/tutorials/samegame/samegame1/Block.qml b/examples/declarative/tutorials/samegame/samegame1/Block.qml index b76e61a..f133b17 100644 --- a/examples/declarative/tutorials/samegame/samegame1/Block.qml +++ b/examples/declarative/tutorials/samegame/samegame1/Block.qml @@ -5,7 +5,7 @@ Item { id:block Image { id: img - source: "pics/redStone.png"; + source: "../shared/pics/redStone.png"; anchors.fill: parent } } diff --git a/examples/declarative/tutorials/samegame/samegame1/pics/background.png b/examples/declarative/tutorials/samegame/samegame1/pics/background.png deleted file mode 100644 index 3734a27..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame1/pics/background.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame1/pics/redStone.png b/examples/declarative/tutorials/samegame/samegame1/pics/redStone.png deleted file mode 100644 index 36b09a2..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame1/pics/redStone.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame1/samegame.qml b/examples/declarative/tutorials/samegame/samegame1/samegame.qml index c2d3939..5ed30c9 100644 --- a/examples/declarative/tutorials/samegame/samegame1/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame1/samegame.qml @@ -12,7 +12,7 @@ Rectangle { Image { id: background - anchors.fill: parent; source: "pics/background.png" + anchors.fill: parent; source: "../shared/pics/background.jpg" fillMode: Image.PreserveAspectCrop } } diff --git a/examples/declarative/tutorials/samegame/samegame2/Block.qml b/examples/declarative/tutorials/samegame/samegame2/Block.qml index 228ac4e..e4b3354 100644 --- a/examples/declarative/tutorials/samegame/samegame2/Block.qml +++ b/examples/declarative/tutorials/samegame/samegame2/Block.qml @@ -4,7 +4,7 @@ Item { id:block Image { id: img - source: "pics/redStone.png"; + source: "../shared/pics/redStone.png"; anchors.fill: parent } } diff --git a/examples/declarative/tutorials/samegame/samegame2/pics/background.png b/examples/declarative/tutorials/samegame/samegame2/pics/background.png deleted file mode 100644 index 3734a27..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame2/pics/background.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame2/pics/redStone.png b/examples/declarative/tutorials/samegame/samegame2/pics/redStone.png deleted file mode 100644 index 36b09a2..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame2/pics/redStone.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.qml b/examples/declarative/tutorials/samegame/samegame2/samegame.qml index 8d837da..7e0bc0c 100644 --- a/examples/declarative/tutorials/samegame/samegame2/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame2/samegame.qml @@ -14,7 +14,7 @@ Rectangle { Image { id: background - anchors.fill: parent; source: "pics/background.png" + anchors.fill: parent; source: "../shared/pics/background.jpg" fillMode: Image.PreserveAspectCrop } } diff --git a/examples/declarative/tutorials/samegame/samegame3/Block.qml b/examples/declarative/tutorials/samegame/samegame3/Block.qml index 30a8d3a..7620104 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Block.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Block.qml @@ -8,11 +8,11 @@ Item { Image { id: img source: { if(type == 0){ - "pics/redStone.png"; + "../shared/pics/redStone.png"; } else if(type == 1) { - "pics/blueStone.png"; + "../shared/pics/blueStone.png"; } else { - "pics/greenStone.png"; + "../shared/pics/greenStone.png"; } } anchors.fill: parent diff --git a/examples/declarative/tutorials/samegame/samegame3/pics/background.png b/examples/declarative/tutorials/samegame/samegame3/pics/background.png deleted file mode 100644 index 3734a27..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame3/pics/background.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame3/pics/blueStone.png b/examples/declarative/tutorials/samegame/samegame3/pics/blueStone.png deleted file mode 100644 index 20e43c7..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame3/pics/blueStone.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame3/pics/greenStone.png b/examples/declarative/tutorials/samegame/samegame3/pics/greenStone.png deleted file mode 100644 index b568a19..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame3/pics/greenStone.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame3/pics/redStone.png b/examples/declarative/tutorials/samegame/samegame3/pics/redStone.png deleted file mode 100644 index 36b09a2..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame3/pics/redStone.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.qml b/examples/declarative/tutorials/samegame/samegame3/samegame.qml index c616397..168bf9b 100644 --- a/examples/declarative/tutorials/samegame/samegame3/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame3/samegame.qml @@ -13,7 +13,7 @@ Rectangle { Image { id: background - anchors.fill: parent; source: "pics/background.png" + anchors.fill: parent; source: "../shared/pics/background.jpg" fillMode: Image.PreserveAspectCrop } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml index 4c2ba43..85c2c93 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml @@ -16,11 +16,11 @@ Item { id:block Image { id: img source: { if(type == 0){ - "pics/redStone.png"; + "../../shared/pics/redStone.png"; } else if(type == 1) { - "pics/blueStone.png"; + "../../shared/pics/blueStone.png"; } else { - "pics/greenStone.png"; + "../../shared/pics/greenStone.png"; } } opacity: 0 @@ -38,11 +38,11 @@ Item { id:block velocity: 100; velocityDeviation:30; source: { if(type == 0){ - "pics/redStar.png"; + "../../shared/pics/redStar.png"; } else if (type == 1) { - "pics/blueStar.png"; + "../../shared/pics/blueStar.png"; } else { - "pics/greenStar.png"; + "../../shared/pics/greenStar.png"; } } } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/background.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/background.png deleted file mode 100644 index 3734a27..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame4/content/pics/background.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/blueStar.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/blueStar.png deleted file mode 100644 index ff9588f..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame4/content/pics/blueStar.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/blueStone.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/blueStone.png deleted file mode 100644 index 20e43c7..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame4/content/pics/blueStone.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/greenStar.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/greenStar.png deleted file mode 100644 index cd06854..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame4/content/pics/greenStar.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/greenStone.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/greenStone.png deleted file mode 100644 index b568a19..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame4/content/pics/greenStone.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/redStar.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/redStar.png deleted file mode 100644 index 0a4dffe..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame4/content/pics/redStar.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/redStone.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/redStone.png deleted file mode 100644 index 36b09a2..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame4/content/pics/redStone.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/star.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/star.png deleted file mode 100644 index defbde5..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame4/content/pics/star.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame4/content/pics/yellowStone.png b/examples/declarative/tutorials/samegame/samegame4/content/pics/yellowStone.png deleted file mode 100644 index b1ce762..0000000 Binary files a/examples/declarative/tutorials/samegame/samegame4/content/pics/yellowStone.png and /dev/null differ diff --git a/examples/declarative/tutorials/samegame/samegame4/samegame.qml b/examples/declarative/tutorials/samegame/samegame4/samegame.qml index a228e60..c2e8018 100644 --- a/examples/declarative/tutorials/samegame/samegame4/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame4/samegame.qml @@ -12,7 +12,7 @@ Rectangle { Image { id: background - anchors.fill: parent; source: "content/pics/background.png" + anchors.fill: parent; source: "../shared/pics/background.jpg" fillMode: Image.PreserveAspectCrop } diff --git a/examples/declarative/tutorials/samegame/shared/pics/background.jpg b/examples/declarative/tutorials/samegame/shared/pics/background.jpg new file mode 100644 index 0000000..903d395 Binary files /dev/null and b/examples/declarative/tutorials/samegame/shared/pics/background.jpg differ diff --git a/examples/declarative/tutorials/samegame/shared/pics/blueStar.png b/examples/declarative/tutorials/samegame/shared/pics/blueStar.png new file mode 100644 index 0000000..ff9588f Binary files /dev/null and b/examples/declarative/tutorials/samegame/shared/pics/blueStar.png differ diff --git a/examples/declarative/tutorials/samegame/shared/pics/blueStone.png b/examples/declarative/tutorials/samegame/shared/pics/blueStone.png new file mode 100644 index 0000000..20e43c7 Binary files /dev/null and b/examples/declarative/tutorials/samegame/shared/pics/blueStone.png differ diff --git a/examples/declarative/tutorials/samegame/shared/pics/greenStar.png b/examples/declarative/tutorials/samegame/shared/pics/greenStar.png new file mode 100644 index 0000000..cd06854 Binary files /dev/null and b/examples/declarative/tutorials/samegame/shared/pics/greenStar.png differ diff --git a/examples/declarative/tutorials/samegame/shared/pics/greenStone.png b/examples/declarative/tutorials/samegame/shared/pics/greenStone.png new file mode 100644 index 0000000..b568a19 Binary files /dev/null and b/examples/declarative/tutorials/samegame/shared/pics/greenStone.png differ diff --git a/examples/declarative/tutorials/samegame/shared/pics/redStar.png b/examples/declarative/tutorials/samegame/shared/pics/redStar.png new file mode 100644 index 0000000..0a4dffe Binary files /dev/null and b/examples/declarative/tutorials/samegame/shared/pics/redStar.png differ diff --git a/examples/declarative/tutorials/samegame/shared/pics/redStone.png b/examples/declarative/tutorials/samegame/shared/pics/redStone.png new file mode 100644 index 0000000..36b09a2 Binary files /dev/null and b/examples/declarative/tutorials/samegame/shared/pics/redStone.png differ diff --git a/examples/declarative/tutorials/samegame/shared/pics/star.png b/examples/declarative/tutorials/samegame/shared/pics/star.png new file mode 100644 index 0000000..defbde5 Binary files /dev/null and b/examples/declarative/tutorials/samegame/shared/pics/star.png differ diff --git a/examples/declarative/tutorials/samegame/shared/pics/yellowStone.png b/examples/declarative/tutorials/samegame/shared/pics/yellowStone.png new file mode 100644 index 0000000..b1ce762 Binary files /dev/null and b/examples/declarative/tutorials/samegame/shared/pics/yellowStone.png differ -- cgit v0.12