From 1ee038d05089aea25d3602f3e65592d7dd07b76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Mon, 21 Sep 2009 18:18:26 +0200 Subject: Fixed compile for example support library --- examples/declarative/support/contact.cpp | 8 +++----- examples/declarative/support/contact.h | 5 ++--- examples/declarative/support/contactmodel.cpp | 5 ++--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/examples/declarative/support/contact.cpp b/examples/declarative/support/contact.cpp index 0821295..9ffeb97 100644 --- a/examples/declarative/support/contact.cpp +++ b/examples/declarative/support/contact.cpp @@ -12,7 +12,6 @@ ****************************************************************************/ #include "contact.h" -#include "qmltypes.h" QML_DEFINE_TYPE(0,0,0,0,Contact,Contact); Contact::Contact() : QObject(0) @@ -26,13 +25,13 @@ Contact::Contact() : QObject(0) m_numbers << new PhoneNumber; m_numbers << new PhoneNumber; m_numbers << new PhoneNumber; - + m_numbers.at(0)->setType(PhoneNumber::HomePhone); m_numbers.at(0)->setNumber("35412451"); m_numbers.at(1)->setType(PhoneNumber::BusinessPhone); m_numbers.at(1)->setNumber("33424994"); - + m_numbers.at(2)->setType(PhoneNumber::MobilePhone); m_numbers.at(2)->setNumber("0424655137"); @@ -52,8 +51,7 @@ Contact::Contact() : QObject(0) void Contact::addNumber(PhoneNumber *newNumber) { - - m_numbers << newNumber; + m_numbers << newNumber; emit numbersChanged(); } diff --git a/examples/declarative/support/contact.h b/examples/declarative/support/contact.h index c403f8b..7b25869 100644 --- a/examples/declarative/support/contact.h +++ b/examples/declarative/support/contact.h @@ -15,8 +15,7 @@ #define CONTACT_H #include -#include - +#include class Address : public QObject { @@ -105,7 +104,7 @@ public: Q_PROPERTY(QList* numbers READ numbers); QList* numbers() { return &m_numbers; } - + void addEmail(QString&); void addAddress(Address*); void addNumber(PhoneNumber*); diff --git a/examples/declarative/support/contactmodel.cpp b/examples/declarative/support/contactmodel.cpp index efe108fb..ff71b9c 100644 --- a/examples/declarative/support/contactmodel.cpp +++ b/examples/declarative/support/contactmodel.cpp @@ -12,7 +12,6 @@ ****************************************************************************/ #include "contactmodel.h" -#include "qmltypes.h" ContactModel::ContactModel(QObject *parent) : QListModelInterface(parent) { @@ -29,7 +28,7 @@ ContactModel::ContactModel(QObject *parent) : QListModelInterface(parent) c->addEmail(list[i]); //contactList.append(c); insertContact(c); - + text = ts.readLine(); } f.close(); @@ -149,7 +148,7 @@ int ContactModel::findIndex(QString &searchName) const else return middle; } return start; -} +} int ContactModel::isAfter(QString &name1, QString &name2) const { -- cgit v0.12 From ab3634173ba5d5ed084710a32508ea728378d038 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 22 Sep 2009 09:45:55 +1000 Subject: Repeater doc update. --- doc/src/snippets/declarative/repeater.qml | 16 +++++++++------- src/declarative/fx/qfxrepeater.cpp | 10 +++++----- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/doc/src/snippets/declarative/repeater.qml b/doc/src/snippets/declarative/repeater.qml index 309fead..f8ac856 100644 --- a/doc/src/snippets/declarative/repeater.qml +++ b/doc/src/snippets/declarative/repeater.qml @@ -1,14 +1,16 @@ import Qt 4.6 +Rectangle { + width: 220; height: 20; color: "white" + //! [0] -Rectangle { width: 220; height: 20; color: "white" - Component { id: Dot - Rectangle { width: 20; height: 20; radius: 10; color: "green" } - } - HorizontalLayout { + Row { Rectangle { width: 10; height: 20; color: "red" } - Repeater { component: Dot; dataSource: 10 } + Repeater { + model: 10 + Rectangle { width: 20; height: 20; radius: 10; color: "green" } + } Rectangle { width: 10; height: 20; color: "blue" } } -} //! [0] +} diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp index 719aea9..84804ce 100644 --- a/src/declarative/fx/qfxrepeater.cpp +++ b/src/declarative/fx/qfxrepeater.cpp @@ -62,15 +62,15 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Repeater,QFxRepeater) \qmlclass Repeater \inherits Item - \brief The Repeater item allows you to repeat a component based on a data source. + \brief The Repeater item allows you to repeat a component based on a model. The Repeater item is used when you want to create a large number of - similar items. For each entry in the data source, an item is instantiated - in a context seeded with data from the data source. If the repeater will + similar items. For each entry in the model, an item is instantiated + in a context seeded with data from the model. If the repeater will be instantiating a large number of instances, it may be more efficient to use one of Qt Declarative's \l {xmlViews}{view items}. - The data source may be either an object list, a string list or a Qt model. + The model may be either an object list, a string list, a number or a Qt model. In each case, the data element and the index is exposed to each instantiated component. The index is always exposed as an accessible \c index property. In the case of an object or string list, the data element (of type string @@ -131,7 +131,7 @@ QFxRepeater::~QFxRepeater() The model providing data for the repeater. - The model may be either an object list, a string list or a Qt model. + The model may be either an object list, a string list, a number or a Qt model. In each case, the data element and the index is exposed to each instantiated component. The index is always exposed as an accessible \c index property. In the case of an object or string list, the data element (of type string -- cgit v0.12 From c38c6f984f3b08db106dcd249c3339d42cc82aa3 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 22 Sep 2009 10:06:49 +1000 Subject: Missing files. --- examples/declarative/modules/local/Foo.qml | 6 ++++++ examples/declarative/modules/local/SubLib/Bar.qml | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 examples/declarative/modules/local/Foo.qml create mode 100644 examples/declarative/modules/local/SubLib/Bar.qml diff --git a/examples/declarative/modules/local/Foo.qml b/examples/declarative/modules/local/Foo.qml new file mode 100644 index 0000000..6cb07d5 --- /dev/null +++ b/examples/declarative/modules/local/Foo.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +Text { + text: "lib/Foo.qml" + color: "#00ff00" +} diff --git a/examples/declarative/modules/local/SubLib/Bar.qml b/examples/declarative/modules/local/SubLib/Bar.qml new file mode 100644 index 0000000..ad09d2e --- /dev/null +++ b/examples/declarative/modules/local/SubLib/Bar.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +Text { + text: "lib/SubLib/Bar.qml" + color: "#8898FF" +} -- cgit v0.12 From d125e01313b269d70577975f6e78d28a9105ada1 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 22 Sep 2009 10:07:01 +1000 Subject: Ensure absolute path for qmldir URL. --- src/declarative/qml/qmlengine.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index c6edbe2..dd6b5a4 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -1519,8 +1519,9 @@ public: bool found = false; foreach (QString p, importPath) { QString dir = p+QLatin1Char('/')+url; - if (QFile::exists(dir+QLatin1String("/qmldir"))) { - url = QLatin1String("file://")+dir; + QFileInfo fi(dir+QLatin1String("/qmldir")); + if (fi.isFile()) { + url = QUrl::fromLocalFile(fi.absolutePath()).toString(); found = true; break; } -- cgit v0.12 From 7aee99a762280251297486f118ca2a3cd6762883 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 22 Sep 2009 10:24:23 +1000 Subject: Syntax update id must not be a type Image::fillMode change --- examples/declarative/aspectratio/face_fit.qml | 6 +++--- .../declarative/aspectratio/face_fit_animated.qml | 6 +++--- examples/declarative/aspectratio/scale_and_crop.qml | 6 +++--- .../declarative/aspectratio/scale_and_crop_simple.qml | 19 +++++++++++++++++++ .../declarative/aspectratio/scale_and_sidecrop.qml | 6 +++--- examples/declarative/aspectratio/scale_to_fit.qml | 6 +++--- .../declarative/aspectratio/scale_to_fit_simple.qml | 10 +++++----- 7 files changed, 39 insertions(+), 20 deletions(-) create mode 100644 examples/declarative/aspectratio/scale_and_crop_simple.qml diff --git a/examples/declarative/aspectratio/face_fit.qml b/examples/declarative/aspectratio/face_fit.qml index 4573160..8d38cca 100644 --- a/examples/declarative/aspectratio/face_fit.qml +++ b/examples/declarative/aspectratio/face_fit.qml @@ -8,13 +8,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/face_fit_animated.qml b/examples/declarative/aspectratio/face_fit_animated.qml index 7db1c80..7d73900 100644 --- a/examples/declarative/aspectratio/face_fit_animated.qml +++ b/examples/declarative/aspectratio/face_fit_animated.qml @@ -6,13 +6,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_and_crop.qml b/examples/declarative/aspectratio/scale_and_crop.qml index 75080b4..3cace8d 100644 --- a/examples/declarative/aspectratio/scale_and_crop.qml +++ b/examples/declarative/aspectratio/scale_and_crop.qml @@ -4,13 +4,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_and_crop_simple.qml b/examples/declarative/aspectratio/scale_and_crop_simple.qml new file mode 100644 index 0000000..26758e6 --- /dev/null +++ b/examples/declarative/aspectratio/scale_and_crop_simple.qml @@ -0,0 +1,19 @@ +import Qt 4.6 + +// Here, we implement "Scale to Fit" behaviour, using the +// fillMode property. +// +Rectangle { + // default size: whole image, unscaled + width: Face.width + height: Face.height + color: "gray" + clip: true + + Image { + id: Face + source: "pics/face.png" + fillMode: "PreserveAspectCrop" + anchors.fill: parent + } +} diff --git a/examples/declarative/aspectratio/scale_and_sidecrop.qml b/examples/declarative/aspectratio/scale_and_sidecrop.qml index a6bd2c8..18cc110 100644 --- a/examples/declarative/aspectratio/scale_and_sidecrop.qml +++ b/examples/declarative/aspectratio/scale_and_sidecrop.qml @@ -5,13 +5,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_to_fit.qml b/examples/declarative/aspectratio/scale_to_fit.qml index 744abce..7450ea4 100644 --- a/examples/declarative/aspectratio/scale_to_fit.qml +++ b/examples/declarative/aspectratio/scale_to_fit.qml @@ -5,13 +5,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_to_fit_simple.qml b/examples/declarative/aspectratio/scale_to_fit_simple.qml index 4ee06ba..dcccd69 100644 --- a/examples/declarative/aspectratio/scale_to_fit_simple.qml +++ b/examples/declarative/aspectratio/scale_to_fit_simple.qml @@ -1,19 +1,19 @@ import Qt 4.6 // Here, we implement "Scale to Fit" behaviour, using the -// preserveAspect property. +// fillMode property. // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" - fillMode: "PreserveAspect" + fillMode: "PreserveAspectFit" anchors.fill: parent } } -- cgit v0.12 From 5e5c9c8a7b3184f1c7874fec47d9e3c133cb7146 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 22 Sep 2009 10:38:30 +1000 Subject: import does not currently insist on a version, it should for these cases (but not for non-installed local files) --- .../declarative/qmlparser/importVersionMissingBuiltIn.errors.txt | 1 + tests/auto/declarative/qmlparser/importVersionMissingBuiltIn.qml | 7 +++++++ .../declarative/qmlparser/importVersionMissingInstalled.errors.txt | 1 + tests/auto/declarative/qmlparser/importVersionMissingInstalled.qml | 3 +++ tests/auto/declarative/qmlparser/tst_qmlparser.cpp | 2 ++ 5 files changed, 14 insertions(+) create mode 100644 tests/auto/declarative/qmlparser/importVersionMissingBuiltIn.errors.txt create mode 100644 tests/auto/declarative/qmlparser/importVersionMissingBuiltIn.qml create mode 100644 tests/auto/declarative/qmlparser/importVersionMissingInstalled.errors.txt create mode 100644 tests/auto/declarative/qmlparser/importVersionMissingInstalled.qml diff --git a/tests/auto/declarative/qmlparser/importVersionMissingBuiltIn.errors.txt b/tests/auto/declarative/qmlparser/importVersionMissingBuiltIn.errors.txt new file mode 100644 index 0000000..2235cbc --- /dev/null +++ b/tests/auto/declarative/qmlparser/importVersionMissingBuiltIn.errors.txt @@ -0,0 +1 @@ +SHOULD GIVE AN ERROR ABOUT MISSING VERSION diff --git a/tests/auto/declarative/qmlparser/importVersionMissingBuiltIn.qml b/tests/auto/declarative/qmlparser/importVersionMissingBuiltIn.qml new file mode 100644 index 0000000..23ed566 --- /dev/null +++ b/tests/auto/declarative/qmlparser/importVersionMissingBuiltIn.qml @@ -0,0 +1,7 @@ +import Test as S + +S.MyQmlObject { + property real x; + property real y; +} + diff --git a/tests/auto/declarative/qmlparser/importVersionMissingInstalled.errors.txt b/tests/auto/declarative/qmlparser/importVersionMissingInstalled.errors.txt new file mode 100644 index 0000000..2235cbc --- /dev/null +++ b/tests/auto/declarative/qmlparser/importVersionMissingInstalled.errors.txt @@ -0,0 +1 @@ +SHOULD GIVE AN ERROR ABOUT MISSING VERSION diff --git a/tests/auto/declarative/qmlparser/importVersionMissingInstalled.qml b/tests/auto/declarative/qmlparser/importVersionMissingInstalled.qml new file mode 100644 index 0000000..97ec222 --- /dev/null +++ b/tests/auto/declarative/qmlparser/importVersionMissingInstalled.qml @@ -0,0 +1,3 @@ +import com.nokia.installedtest as T + +T.InstalledTest {} diff --git a/tests/auto/declarative/qmlparser/tst_qmlparser.cpp b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp index b8bd0e7..ee1b072 100644 --- a/tests/auto/declarative/qmlparser/tst_qmlparser.cpp +++ b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp @@ -160,6 +160,8 @@ void tst_qmlparser::errors_data() QTest::newRow("finalOverride") << "finalOverride.qml" << "finalOverride.errors.txt" << false; QTest::newRow("importNamespaceConflict") << "importNamespaceConflict.qml" << "importNamespaceConflict.errors.txt" << false; + QTest::newRow("importVersionMissing (builtin)") << "importVersionMissingBuiltIn.qml" << "importVersionMissingBuiltIn.errors.txt" << false; + QTest::newRow("importVersionMissing (installed)") << "importVersionMissingInstalled.qml" << "importVersionMissingInstalled.errors.txt" << false; QTest::newRow("customParserIdNotAllowed") << "customParserIdNotAllowed.qml" << "customParserIdNotAllowed.errors.txt" << false; } -- cgit v0.12