diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-01-23 18:27:44 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-01-23 18:28:44 +0100 |
commit | 44b7d97d565677d6decbef2d010709bdb3d7cbd4 (patch) | |
tree | 853e6504899a735ff2ea02df54cf7acd07fde52f | |
parent | 40574b466a5773fdb7ccddded45e237df375d848 (diff) | |
parent | 742cff521a366e907ceddbd441b8a34101e58d01 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Change-Id: I1656c712dfe99bc37d8ff21caa4ea51c3b375952
-rw-r--r-- | examples/quick/accessibility/accessibility.qml | 27 | ||||
-rw-r--r-- | examples/quick/accessibility/content/Button.qml | 4 | ||||
-rw-r--r-- | examples/quick/accessibility/content/Checkbox.qml | 7 | ||||
-rw-r--r-- | examples/quick/accessibility/content/Slider.qml | 11 | ||||
-rw-r--r-- | src/quick/doc/snippets/qml/path/basiccurve.qml | 1 | ||||
-rw-r--r-- | src/quick/items/qquickpathview.cpp | 10 | ||||
-rw-r--r-- | src/quick/util/qquickimageprovider.cpp | 6 | ||||
-rw-r--r-- | tests/auto/quick/qquickpathview/data/emptypath.qml | 6 | ||||
-rw-r--r-- | tests/auto/quick/qquickpathview/tst_qquickpathview.cpp | 14 | ||||
-rw-r--r-- | tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp | 2 |
10 files changed, 61 insertions, 27 deletions
diff --git a/examples/quick/accessibility/accessibility.qml b/examples/quick/accessibility/accessibility.qml index 1d6b4ab76b..6fb25e37d7 100644 --- a/examples/quick/accessibility/accessibility.qml +++ b/examples/quick/accessibility/accessibility.qml @@ -42,7 +42,6 @@ import QtQuick 2.0 import "content" - Rectangle { id: window @@ -56,11 +55,9 @@ Rectangle { anchors.margins: 10 width: parent.width - Row { spacing: 6 width: column.width - height: column.h Text { id: subjectLabel @@ -71,6 +68,7 @@ Rectangle { text: "Subject:" y: 3 } + Rectangle { id: subjectBorder Accessible.role: Accessible.EditableText @@ -88,19 +86,18 @@ Rectangle { text: "Vacation plans" KeyNavigation.tab: textEdit } - } - } + Rectangle { id: textBorder Accessible.role: Accessible.EditableText - property alias text : textEdit.text + property alias text: textEdit.text border.width: 1 border.color: "black" width: parent.width - 2 - height: 200 + TextEdit { id: textEdit y: 3 @@ -113,6 +110,7 @@ Rectangle { KeyNavigation.priority: KeyNavigation.BeforeItem } } + Text { id : status width: column.width @@ -120,23 +118,30 @@ Rectangle { Row { spacing: 6 - Button { id: sendButton; width: 100; height: column.h + 20; text: "Send"; - onClicked : { status.text = "Send" } + Button { + id: sendButton + width: 100; height: 20 + text: "Send" + onClicked: { status.text = "Send" } KeyNavigation.tab: discardButton } - Button { id: discardButton; width: 100; height: column.h + 20; text: "Discard"; - onClicked : { status.text = "Discard" } + Button { id: discardButton + width: 100; height: 20 + text: "Discard" + onClicked: { status.text = "Discard" } KeyNavigation.tab: checkBox } } Row { spacing: 6 + Checkbox { id: checkBox checked: false KeyNavigation.tab: slider } + Slider { id: slider value: 10 diff --git a/examples/quick/accessibility/content/Button.qml b/examples/quick/accessibility/content/Button.qml index 8afc1978ee..4034f074a9 100644 --- a/examples/quick/accessibility/content/Button.qml +++ b/examples/quick/accessibility/content/Button.qml @@ -64,8 +64,7 @@ Rectangle { GradientStop { position: 1.0; color: button.focus ? "red" : "blue" } } - // border.width: 1 - //border.color: "black"; + radius: 5 antialiasing: true @@ -84,5 +83,6 @@ Rectangle { anchors.fill: parent onClicked: parent.clicked() } + Keys.onSpacePressed: clicked() } diff --git a/examples/quick/accessibility/content/Checkbox.qml b/examples/quick/accessibility/content/Checkbox.qml index c67d593f1d..7c20f55e90 100644 --- a/examples/quick/accessibility/content/Checkbox.qml +++ b/examples/quick/accessibility/content/Checkbox.qml @@ -39,10 +39,8 @@ ** ****************************************************************************/ - import QtQuick 2.0 - FocusScope { id: checkbox @@ -56,24 +54,29 @@ FocusScope { Row { spacing: 2 + Rectangle { width: 12 height: 12 border.width: checkbox.focus ? 2 : 1 border.color: "black" + Text { id: checkboxText text: checkbox.checked ? "x" : "" anchors.centerIn: parent } } + Text { text: checkbox.text } } + MouseArea { anchors.fill: parent onClicked: checkbox.checked = !checkbox.checked } + Keys.onSpacePressed: checkbox.checked = !checkbox.checked } diff --git a/examples/quick/accessibility/content/Slider.qml b/examples/quick/accessibility/content/Slider.qml index 314c7af798..c6eaca30a2 100644 --- a/examples/quick/accessibility/content/Slider.qml +++ b/examples/quick/accessibility/content/Slider.qml @@ -39,7 +39,6 @@ ** ****************************************************************************/ - import QtQuick 2.0 // Minimal slider implementation @@ -49,10 +48,10 @@ Rectangle { property alias text: buttonText.text Accessible.role: Accessible.Slider - property int value : 5 // required - property int minimumValue : 0 // optional (default INT_MIN) - property int maximumValue : 20 // optional (default INT_MAX) - property int stepSize : 1 // optional (default 1) + property int value: 5 // required + property int minimumValue: 0 // optional (default INT_MIN) + property int maximumValue: 20 // optional (default INT_MAX) + property int stepSize: 1 // optional (default 1) width: 100 height: 30 @@ -77,6 +76,7 @@ Rectangle { anchors.centerIn: parent font.pixelSize: parent.height * .5 } + MouseArea { anchors.fill: parent onClicked: { @@ -84,6 +84,7 @@ Rectangle { slider.value = pos } } + Keys.onLeftPressed: value > minimumValue ? value = value - stepSize : minimumValue Keys.onRightPressed: value < maximumValue ? value = value + stepSize : maximumValue } diff --git a/src/quick/doc/snippets/qml/path/basiccurve.qml b/src/quick/doc/snippets/qml/path/basiccurve.qml index 4a97f1bc96..ca554c56a0 100644 --- a/src/quick/doc/snippets/qml/path/basiccurve.qml +++ b/src/quick/doc/snippets/qml/path/basiccurve.qml @@ -43,6 +43,7 @@ import QtQuick 2.0 Canvas { width: 400; height: 200 + contextType: "2d" Path { id: myPath diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index a58ed599be..a7be50bc11 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -193,7 +193,7 @@ void QQuickPathView::initItem(int index, QQuickItem *item) if (att) { att->m_view = this; qreal percent = d->positionOfIndex(index); - if (percent < 1.0) { + if (percent < 1.0 && d->path) { foreach (const QString &attr, d->path->attributes()) att->setValue(attr.toUtf8(), d->path->attributeAt(attr, percent)); item->setZ(d->requestedZ); @@ -227,8 +227,10 @@ QQmlOpenMetaObjectType *QQuickPathViewPrivate::attachedType() if (!attType) { // pre-create one metatype to share with all attached objects attType = new QQmlOpenMetaObjectType(&QQuickPathViewAttached::staticMetaObject, qmlEngine(q)); - foreach (const QString &attr, path->attributes()) - attType->createProperty(attr.toUtf8()); + if (path) { + foreach (const QString &attr, path->attributes()) + attType->createProperty(attr.toUtf8()); + } } return attType; @@ -423,6 +425,8 @@ void QQuickPathView::pathUpdated() void QQuickPathViewPrivate::updateItem(QQuickItem *item, qreal percent) { + if (!path) + return; if (QQuickPathViewAttached *att = attached(item)) { if (qFuzzyCompare(att->m_percent, percent)) return; diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp index 5242269393..fb75a7669e 100644 --- a/src/quick/util/qquickimageprovider.cpp +++ b/src/quick/util/qquickimageprovider.cpp @@ -169,7 +169,7 @@ QImage QQuickTextureFactory::image() const an image provider named "colors", and the images to be loaded are "yellow" and "red", respectively: - \snippet qml/imageprovider/imageprovider-example.qml 0 + \snippet quick/imageprovider/imageprovider-example.qml 0 When these images are loaded by QML, it looks for a matching image provider and calls its requestImage() or requestPixmap() method (depending on its @@ -180,9 +180,9 @@ QImage QQuickTextureFactory::image() const requested by the above QML. This implementation dynamically generates QPixmap images that are filled with the requested color: - \snippet qml/imageprovider/imageprovider.cpp 0 + \snippet quick/imageprovider/imageprovider.cpp 0 \codeline - \snippet qml/imageprovider/imageprovider.cpp 1 + \snippet quick/imageprovider/imageprovider.cpp 1 To make this provider accessible to QML, it is registered with the QML engine with a "colors" identifier: diff --git a/tests/auto/quick/qquickpathview/data/emptypath.qml b/tests/auto/quick/qquickpathview/data/emptypath.qml new file mode 100644 index 0000000000..d68cf4491b --- /dev/null +++ b/tests/auto/quick/qquickpathview/data/emptypath.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +PathView { + model: 1 + delegate: Item {} +} diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index a78625c58e..65fef9abe5 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -118,6 +118,7 @@ private slots: void pathUpdateOnStartChanged(); void package(); void emptyModel(); + void emptyPath(); void closed(); void pathUpdate(); void visualDataModel(); @@ -1354,6 +1355,19 @@ void tst_QQuickPathView::emptyModel() } +void tst_QQuickPathView::emptyPath() +{ + QQuickView *window = createView(); + + window->setSource(testFileUrl("emptypath.qml")); + qApp->processEvents(); + + QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); + QVERIFY(pathview != 0); + + delete window; +} + void tst_QQuickPathView::closed() { QQmlEngine engine; diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index 5b2ac2525e..0139e156c3 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -2329,7 +2329,7 @@ void tst_qquicktextedit::cursorDelegate() void tst_qquicktextedit::remoteCursorDelegate() { TestHTTPServer server(SERVER_PORT); - server.serveDirectory(dataDirectory()); + server.serveDirectory(dataDirectory(), TestHTTPServer::Delay); QQuickView view; |