From 1042834e11befa48e615775e853ac0f4d4bef5af Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 08:32:42 +1000 Subject: ignore chart exe --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d0e9c5f..1b29fca 100644 --- a/.gitignore +++ b/.gitignore @@ -107,6 +107,7 @@ tests/auto/qprocess/fileWriterProcess.txt tests/auto/qlibrary/libmylib.so* tests/auto/qresourceengine/runtime_resource.rcc tools/qdoc3/qdoc3* +tools/qtestlib/chart/chart* tools/qtestlib/updater/updater* tools/activeqt/testcon/testcon.tlb translations/*.qm -- cgit v0.12 From c3008c1df3017d0b9a4280def69c99be181a3689 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 09:59:10 +1000 Subject: Check initial preferredHeight. --- tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp index 6bd28fb..543ba3f 100644 --- a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp +++ b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp @@ -143,6 +143,7 @@ void tst_qmlgraphicswebview::basicProperties() QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->html())); QCOMPARE(wv->width(), 123.0); QCOMPARE(wv->preferredWidth(), 0); + QCOMPARE(wv->preferredHeight(), 0); QCOMPARE(wv->zoomFactor(), 1.0); QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); QCOMPARE(wv->status(), QmlGraphicsWebView::Ready); -- cgit v0.12 From 99ff19eab317990ae927e42aa5084110ebc1e03a Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 10:08:47 +1000 Subject: Test setting property when not set before. --- tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp index 80efd94..61d0863 100644 --- a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp +++ b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp @@ -111,6 +111,7 @@ void tst_QmlListModel::dynamic_data() QTest::newRow("setprop3b") << "{append({'foo':123,'bar':456});set(0,'foo',999);get(0).bar}" << 456 << ""; QTest::newRow("setprop4a") << "{set(0,'foo',456)}" << 0 << "QML QmlListModel (unknown location) set: index 0 out of range"; QTest::newRow("setprop4a") << "{append({'foo':123,'bar':456});set(1,'foo',456)}" << 0 << "QML QmlListModel (unknown location) set: index 1 out of range"; + QTest::newRow("setprop5") << "{append({'foo':123,'bar':456});append({'foo':111});set(1,'bar',222);get(1).bar}" << 222 << ""; QTest::newRow("move1a") << "{append({'foo':123});append({'foo':456});move(0,1,1);count}" << 2 << ""; QTest::newRow("move1b") << "{append({'foo':123});append({'foo':456});move(0,1,1);get(0).foo}" << 456 << ""; -- cgit v0.12 From 9e5cb8c9e6a8526a26cd6ada9ccec1aba002cf68 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 10:10:46 +1000 Subject: Test one-past-end setting (not error; same as append). --- tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp index 61d0863..95cf68e 100644 --- a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp +++ b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp @@ -104,6 +104,7 @@ void tst_QmlListModel::dynamic_data() QTest::newRow("set4a") << "{set(0,{'foo':456})}" << 0 << "QML QmlListModel (unknown location) set: index 0 out of range"; QTest::newRow("set5a") << "{append({'foo':123,'bar':456});set(0,123)}" << 0 << "QML QmlListModel (unknown location) set: value is not an object"; QTest::newRow("set5b") << "{append({'foo':123,'bar':456});set(0,[1,2,3])}" << 0 << "QML QmlListModel (unknown location) set: value is not an object"; + QTest::newRow("set6") << "{append({'foo':123});set(1,{'foo':456});count}" << 2 << ""; QTest::newRow("setprop1") << "{append({'foo':123});set(0,'foo',456);count}" << 1 << ""; QTest::newRow("setprop2") << "{append({'foo':123});set(0,'foo',456);get(0).foo}" << 456 << ""; -- cgit v0.12 From 831d30af205d5125f762696bb6f9a5f9d1e3c5f5 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 23 Nov 2009 10:53:06 +1000 Subject: Doc. --- src/declarative/graphicsitems/qmlgraphicsitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.cpp b/src/declarative/graphicsitems/qmlgraphicsitem.cpp index fb6afb1..263aea5 100644 --- a/src/declarative/graphicsitems/qmlgraphicsitem.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsitem.cpp @@ -2307,7 +2307,7 @@ void QmlGraphicsItem::setBaselineOffset(qreal offset) Opacity is an \e inherited attribute. That is, the opacity is also applied individually to child items. In almost all cases this is what you want. If you can spot the issue in the following - example, you might need to use an opacity filter (not yet available) instead. + example, you might need to use an \l Opacity effect instead. \table \row -- cgit v0.12 From 7de5a4981144648a158d893542bfe5ad82d6830d Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 11:10:26 +1000 Subject: Tidy (and fix) error messages. --- src/declarative/util/qmllistmodel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index a3c5c59..5491fd7 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -732,11 +732,11 @@ bool QmlListModelParser::compileProperty(const QmlCustomParserProperty &prop, QL for(int jj = 0; jj < props.count(); ++jj) { const QmlCustomParserProperty &nodeProp = props.at(jj); if (nodeProp.name() == "") { - error(nodeProp, QLatin1String("Cannot use default property in ListModel")); + error(nodeProp, QmlListModel::tr("ListElement: cannot use default property")); return false; } if (nodeProp.name() == "id") { - error(nodeProp, QLatin1String("Cannot use reserved \"id\" property in ListModel")); + error(nodeProp, QmlListModel::tr("ListElement: cannot use reserved \"id\" property")); return false; } @@ -792,7 +792,7 @@ QByteArray QmlListModelParser::compile(const QList &cus for(int ii = 0; ii < customProps.count(); ++ii) { const QmlCustomParserProperty &prop = customProps.at(ii); if(prop.name() != "") { // isn't default property - error(prop, QLatin1String("Cannot use default property")); + error(prop, QmlListModel::tr("ListModel: undefined property '%1'").arg(QString::fromUtf8(prop.name()))); return QByteArray(); } -- cgit v0.12 From b316de95032216a90a8262cce3708f781f8ccbd9 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 11:11:53 +1000 Subject: Test error messages. --- .../declarative/qmllistmodel/tst_qmllistmodel.cpp | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp index 95cf68e..f2ffb7b 100644 --- a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp +++ b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include class tst_QmlListModel : public QObject @@ -52,6 +53,8 @@ public: private slots: void dynamic_data(); void dynamic(); + void error_data(); + void error(); }; void tst_QmlListModel::dynamic_data() @@ -155,6 +158,56 @@ void tst_QmlListModel::dynamic() QCOMPARE(actual,result); } +void tst_QmlListModel::error_data() +{ + QTest::addColumn("qml"); + QTest::addColumn("error"); + + QTest::newRow("id not allowed in ListElement") + << "import Qt 4.6\nListModel { ListElement { id: fred } }" + << "ListElement: cannot use reserved \"id\" property"; + + QTest::newRow("id allowed in ListModel") + << "import Qt 4.6\nListModel { id:model }" + << ""; + + QTest::newRow("random properties not allowed in ListModel") + << "import Qt 4.6\nListModel { foo:123 }" + << "ListModel: undefined property 'foo'"; + + QTest::newRow("random properties allowed in ListElement") + << "import Qt 4.6\nListModel { ListElement { foo:123 } }" + << ""; + + QTest::newRow("random object list properties allowed in ListElement") + << "import Qt 4.6\nListModel { ListElement { foo: [ ListElement { bar: 123 } ] } }" + << ""; + + QTest::newRow("default properties not allowed in ListElement") + << "import Qt 4.6\nListModel { ListElement { Item { } } }" + << "QTBUG-6082 ListElement should not allow child objects"; +} + +void tst_QmlListModel::error() +{ + QFETCH(QString, qml); + QFETCH(QString, error); + + QmlEngine engine; + QmlComponent component(&engine, qml.toUtf8(), + QUrl::fromLocalFile(QString("dummy.qml"))); + if (error.isEmpty()) { + QVERIFY(!component.isError()); + } else { + if (error.startsWith(QLatin1String("QTBUG-"))) + QEXPECT_FAIL("",error.toLatin1(),Abort); + QVERIFY(component.isError()); + QList errors = component.errors(); + QCOMPARE(errors.count(),1); + QCOMPARE(errors.at(0).description(),error); + } +} + QTEST_MAIN(tst_QmlListModel) #include "tst_qmllistmodel.moc" -- cgit v0.12 From 13815e441c6e0bb02daced5546965fde65a0cbb7 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 23 Nov 2009 11:29:05 +1000 Subject: Documentation fixes Changed html tags over to qdoc tags. --- src/declarative/util/qmlnumberformatter.cpp | 92 +++++++++++++++++++++-------- 1 file changed, 68 insertions(+), 24 deletions(-) diff --git a/src/declarative/util/qmlnumberformatter.cpp b/src/declarative/util/qmlnumberformatter.cpp index b09be5b..fce35d9 100644 --- a/src/declarative/util/qmlnumberformatter.cpp +++ b/src/declarative/util/qmlnumberformatter.cpp @@ -97,7 +97,7 @@ QmlNumberFormatter::~QmlNumberFormatter() \qmlproperty string NumberFormatter::text The number in the specified format. -
+ If no format is specified the text will be empty. */ @@ -123,38 +123,82 @@ qreal QmlNumberFormatter::number() const \qmlproperty string NumberFormatter::format The particular format the number will adhere to during the conversion to text. -
+ The format syntax follows a style similar to the Unicode Standard (UTS35). The table below shows the characters, patterns that can be used in the format. - - - - - - - -
Character Meaning
# Any digit(s), zero shows as absent (for leading/trailing zeroes)
0 Implicit digit. Zero will show in the case that the input number is too small.
. Decimal separator. Output decimal seperator will be dependant on system locale.
, Grouping separator. The number of digits (either #, or 0) between the grouping separator and the decimal (or the rightmost digit) will determine the groupingSize)
other Any other character will be taken as a string literal and placed directly into the output string
+ \table + \header + \o Character + \o Meaning + \row + \o # + \o Any digit(s), zero shows as absent (for leading/trailing zeroes). + \row + \o 0 + \o Implicit digit. Zero will show in the case that the input number is too small. + \row + \o . + \o Decimal separator. Output decimal seperator will be dependant on system locale. + \row + \o , + \o Grouping separator. The number of digits (either #, or 0) between the grouping separator and the decimal (or the rightmost digit) will determine the groupingSize). + \row + \o other + \o Any other character will be taken as a string literal and placed directly into the output string. + \endtable - Invalid formats will not guarantee a meaningful text output.
+ Invalid formats will not guarantee a meaningful text output. - \note Input numbers that are too long for the given format will be rounded dependent on precison based on the position of the decimal point + \note Input numbers that are too long for the given format will be rounded dependent on precison based on the position of the decimal point. The following table illustrates the output text created by applying some examples of numeric formats to the formatter. - - - - - - - - - - - -
Format Number Output
### 123456 123456
000 123456 123456
###### 1234 1234
000000 1234 001234
##,##0.## 1234.456 1,234.46 (for US locale)
1 234,46 (for FR locale)
000000,000.# 123456 000,123,456 (for US locale)
000 123 456 (for FR locale)
0.0### 0.999997 1.0
(000) 000 - 000 12345678 (012) 345 - 678
#A1212A
+ \table + \header + \o Format + \o Number + \o Output + \row + \o ### + \o 123456 + \o 123456 + \row + \o 000 + \o 123456 + \o 123456 + \row + \o ###### + \o 1234 + \o 1234 + \row + \o 000000 + \o 1234 + \o 001234 + \row + \o ##,##0.## + \o 1234.456 + \o 1,234.46 (for US locale) + \codeline 1 234,46 (for FR locale) + \row + \o 000000,000.# + \o 123456 + \o 000,123,456 (for US locale) + \codeline 000 123 456 (for FR locale) + \row + \o 0.0### + \o 0.999997 + \o 1.0 + \row + \o (000) 000 - 000 + \o 12345678 + \o (012) 345 - 678 + \row + \o #A + \o 12 + \o 12A + \endtable */ QString QmlNumberFormatter::format() const -- cgit v0.12 From 4621721a9c3705dc9fbc3b6f15e6122f913e5c72 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 11:38:16 +1000 Subject: Demonstrate "container" type objects. --- examples/declarative/tabwidget/TabWidget.qml | 42 ++++++++++++++++++++++++++++ examples/declarative/tabwidget/tabs.qml | 29 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 examples/declarative/tabwidget/TabWidget.qml create mode 100644 examples/declarative/tabwidget/tabs.qml diff --git a/examples/declarative/tabwidget/TabWidget.qml b/examples/declarative/tabwidget/TabWidget.qml new file mode 100644 index 0000000..c56f41e --- /dev/null +++ b/examples/declarative/tabwidget/TabWidget.qml @@ -0,0 +1,42 @@ +import Qt 4.6 + +Item { + id: page + property int current: 0 + default property alias content: stack.children + onCurrentChanged: setOpacities() + Component.onCompleted: setOpacities() + function setOpacities() + { + for (var i=0; iRoses are red"; font.pixelSize: 24 + wrap: true; width: parent.width-20 } + } + Rectangle { + property string title: "Green" + color: "green" + anchors.fill: parent + Text { anchors.centerIn: parent; text: "
Flower stems are green"; font.pixelSize: 24; + wrap: true; width: parent.width-20 } + } + Rectangle { + property string title: "Blue" + color: "blue" + anchors.fill: parent + Text { anchors.centerIn: parent; text: "
Violets are blue"; color: "white"; font.pixelSize: 24 + wrap: true; width: parent.width-20 } + } +} -- cgit v0.12