diff options
author | J-P Nurmi <jpnurmi@gmail.com> | 2018-01-31 19:38:45 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@gmail.com> | 2018-01-31 19:39:19 +0200 |
commit | a73307c58cde0a4503a43be94f3892745f68500e (patch) | |
tree | 0d9aab78fa7e6c320a225dd1c69ff80ac8baaa2f | |
parent | 3323ca8e627db560665edb667e52d52233c05601 (diff) | |
parent | 5d27e14e4ca49263d9c3309b5e93d4cb386063cc (diff) |
Merge remote-tracking branch 'origin/5.10' into 5.11
Change-Id: I7c0333dbf959124f6cf5be7837a305b65c08d290
14 files changed, 110 insertions, 5 deletions
diff --git a/examples/quickcontrols2/imagine/automotive/qtquickcontrols2.conf b/examples/quickcontrols2/imagine/automotive/qtquickcontrols2.conf index c8bcdd40..c7fc7a61 100644 --- a/examples/quickcontrols2/imagine/automotive/qtquickcontrols2.conf +++ b/examples/quickcontrols2/imagine/automotive/qtquickcontrols2.conf @@ -2,7 +2,7 @@ Style=Imagine [Imagine] -Path=qrc:/imagine-assets +Path=:/imagine-assets [Imagine\Palette] Text=#6affcd diff --git a/examples/quickcontrols2/imagine/musicplayer/qtquickcontrols2.conf b/examples/quickcontrols2/imagine/musicplayer/qtquickcontrols2.conf index 2fc304eb..33eab6a5 100644 --- a/examples/quickcontrols2/imagine/musicplayer/qtquickcontrols2.conf +++ b/examples/quickcontrols2/imagine/musicplayer/qtquickcontrols2.conf @@ -2,7 +2,7 @@ Style=Imagine [Imagine] -Path=qrc:/imagine-assets +Path=:/imagine-assets [Imagine\Palette] Text=#6b7b89 diff --git a/src/imports/controls/doc/src/includes/qquickimaginestyle.qdocinc b/src/imports/controls/doc/src/includes/qquickimaginestyle.qdocinc index 8acec2a8..f6fe5a97 100644 --- a/src/imports/controls/doc/src/includes/qquickimaginestyle.qdocinc +++ b/src/imports/controls/doc/src/includes/qquickimaginestyle.qdocinc @@ -8,6 +8,21 @@ \li Specifies the \l {imagine-path-attached-prop}{path} to the directory that contains the Imagine style assets. If not specified, the built-in assets are used. + For example, to specify a path to a directory stored in the + \l {The Qt Resource System}{resource system}: + + \badcode + [Imagine] + Path=:/imagine-assets + \endcode + + To specify a relative path to a local directory: + + \badcode + [Imagine] + Path=imagine-assets + \endcode + \note Due to a technical limitation, the path should not be named \e "imagine" if it is relative to the \c qtquickcontrols2.conf file. \endtable @@ -23,6 +38,19 @@ \li Specifies the path to the directory that contains the Imagine style assets. If not specified, the built-in assets are used. + For example, to specify a path to a directory stored in the + \l {The Qt Resource System}{resource system}: + + \badcode + QT_QUICK_CONTROLS_IMAGINE_PATH=:/imagine-assets + \endcode + + To specify a relative path to a local directory: + + \badcode + QT_QUICK_CONTROLS_IMAGINE_PATH=imagine-assets + \endcode + \note Due to a technical limitation, the path should not be named \e "imagine" if it is relative to the \c qtquickcontrols2.conf file. \endtable diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc index eed9ff94..3ab07ae2 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc @@ -122,6 +122,9 @@ their actual counterparts in the Qt Quick Controls 2 module. You can repeat this process for any control that you wish to add. + An added benefit of these three methods is that it's not necessary to + implement the template from scratch. + \section1 Creating a Custom Style There are several ways to go about creating your own styles. Below, we'll @@ -130,12 +133,19 @@ \section2 Definition of a Style In Qt Quick Controls 2, a style is essentially an interchangeable set of - QML files within a single directory. There are two requirements for a style + QML files within a single directory. There are three requirements for a style to be \l {Using Styles in Qt Quick Controls 2}{usable}: \list \li At least one QML file whose name matches a control (for example, \c Button.qml) must exist. + \li Each QML file must contain the relevant type from the \l {Qt Quick Templates 2} + {QtQuick.Templates} import as the root item. For example, + Button.qml must contain a Button template as its root item. + + If we instead used the corresponding type from the \l {Qt Quick Controls 2} + {QtQuick.Controls} import as we did in the previous section, it would not work: + the control we were defining would try to derive from itself. \li The files must be in a directory in the filesystem or in the \l {The Qt Resource System}{resource system}. diff --git a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc index 21eca464..a1a74ec9 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc @@ -137,6 +137,7 @@ \li \l {Imagine Style} \li \l {Material Style} \li \l {Universal Style} + \li \l {Customizing Qt Quick Controls 2} \li \l {Using File Selectors with Qt Quick Controls 2} \li \l {Deploying Qt Quick Controls 2 Applications} \li \l {Qt Quick Controls 2 Configuration File} diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index f1e05b7e..b4d9bead 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -1647,9 +1647,9 @@ void QQuickComboBox::componentComplete() { Q_D(QQuickComboBox); d->executeIndicator(true); + QQuickControl::componentComplete(); if (d->popup) d->executePopup(true); - QQuickControl::componentComplete(); if (d->delegateModel && d->ownModel) static_cast<QQmlDelegateModel *>(d->delegateModel)->componentComplete(); diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp index 9bb122fe..bb5bf668 100644 --- a/src/quicktemplates2/qquickcontrol.cpp +++ b/src/quicktemplates2/qquickcontrol.cpp @@ -1446,6 +1446,7 @@ void QQuickControl::componentComplete() d->executeBackground(true); d->executeContentItem(true); QQuickItem::componentComplete(); + d->resizeBackground(); d->resizeContent(); if (!d->hasLocale) d->locale = QQuickControlPrivate::calcLocale(d->parentItem); diff --git a/src/quicktemplates2/qquickshortcutcontext.cpp b/src/quicktemplates2/qquickshortcutcontext.cpp index b491cab2..e94de722 100644 --- a/src/quicktemplates2/qquickshortcutcontext.cpp +++ b/src/quicktemplates2/qquickshortcutcontext.cpp @@ -76,14 +76,16 @@ bool QQuickShortcutContext::matcher(QObject *obj, Qt::ShortcutContext context) return true; case Qt::WindowShortcut: while (obj && !obj->isWindowType()) { - obj = obj->parent(); item = qobject_cast<QQuickItem *>(obj); if (item) { obj = item->window(); + break; } else if (QQuickPopup *popup = qobject_cast<QQuickPopup *>(obj)) { obj = popup->window(); item = popup->popupItem(); + break; } + obj = obj->parent(); } if (QWindow *renderWindow = QQuickRenderControl::renderWindowFor(qobject_cast<QQuickWindow *>(obj))) obj = renderWindow; diff --git a/tests/auto/controls/data/tst_action.qml b/tests/auto/controls/data/tst_action.qml index 7d057c26..35e65202 100644 --- a/tests/auto/controls/data/tst_action.qml +++ b/tests/auto/controls/data/tst_action.qml @@ -137,4 +137,32 @@ TestCase { keyClick(Qt.Key_B, Qt.ControlModifier) compare(container.lastSource, container.action) } + + Component { + id: actionAndRepeater + Item { + property alias action: testAction + Action { + id: testAction + shortcut: "Ctrl+A" + } + Repeater { + model: 1 + Button { + action: testAction + } + } + } + } + + function test_repeater() { + var container = createTemporaryObject(actionAndRepeater, testCase) + verify(container) + + var spy = signalSpy.createObject(container, {target: container.action, signalName: "triggered"}) + verify(spy.valid) + + keyClick(Qt.Key_A, Qt.ControlModifier) + compare(spy.count, 1) + } } diff --git a/tests/auto/controls/data/tst_popup.qml b/tests/auto/controls/data/tst_popup.qml index 88ec295f..3f9f5e48 100644 --- a/tests/auto/controls/data/tst_popup.qml +++ b/tests/auto/controls/data/tst_popup.qml @@ -1261,4 +1261,12 @@ TestCase { control.open() verify(control.visible) } + + function test_deferredBackgroundSize() { + var control = createTemporaryObject(popupControl, testCase, {width: 200, height: 100}) + verify(control) + + compare(control.background.width, 200 + (control.background.leftInset || 0) + (control.background.rightInset || 0)) + compare(control.background.height, 100 + (control.background.topInset || 0) + (control.background.bottomInset || 0)) + } } diff --git a/tests/auto/controls/data/tst_tumbler.qml b/tests/auto/controls/data/tst_tumbler.qml index 03908566..058cbeca 100644 --- a/tests/auto/controls/data/tst_tumbler.qml +++ b/tests/auto/controls/data/tst_tumbler.qml @@ -349,6 +349,7 @@ TestCase { verify(firstItem); // Test QTBUG-40298. actualPos = testCase.mapFromItem(firstItem, 0, 0); + tryCompare(tumbler, "moving", false); fuzzyCompare(actualPos.x, tumbler.leftPadding, 0.0001); fuzzyCompare(actualPos.y, tumbler.topPadding, 0.0001); diff --git a/tests/auto/customization/tst_customization.cpp b/tests/auto/customization/tst_customization.cpp index 91b5706c..91646653 100644 --- a/tests/auto/customization/tst_customization.cpp +++ b/tests/auto/customization/tst_customization.cpp @@ -487,6 +487,20 @@ void tst_customization::comboPopup() QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1)); QVERIFY(qt_createdQObjects()->contains("combobox-popup-simple")); } + + reset(); + + { + // test that ComboBox::popup is completed upon component completion (if appropriate) + QQmlComponent component(engine); + component.setData("import QtQuick 2.9; import QtQuick.Controls 2.2; ComboBox { id: control; contentItem: Item { visible: !control.popup.visible } popup: Popup { property bool wasCompleted: false; Component.onCompleted: wasCompleted = true } }", QUrl()); + QScopedPointer<QQuickItem> comboBox(qobject_cast<QQuickItem *>(component.create())); + QVERIFY(comboBox); + + QObject *popup = comboBox->property("popup").value<QObject *>(); + QVERIFY(popup); + QCOMPARE(popup->property("wasCompleted"), QVariant(true)); + } } QTEST_MAIN(tst_customization) diff --git a/tests/auto/qquickiconimage/tst_qquickiconimage.cpp b/tests/auto/qquickiconimage/tst_qquickiconimage.cpp index 77b860a2..1dab0784 100644 --- a/tests/auto/qquickiconimage/tst_qquickiconimage.cpp +++ b/tests/auto/qquickiconimage/tst_qquickiconimage.cpp @@ -406,6 +406,9 @@ void tst_qquickiconimage::color() { SKIP_IF_DPR_TOO_HIGH(); + if (QGuiApplication::platformName() == QLatin1String("offscreen")) + QSKIP("grabToImage() doesn't work on the \"offscreen\" platform plugin (QTBUG-63185)"); + QQuickView view(testFileUrl("color.qml")); QCOMPARE(view.status(), QQuickView::Ready); view.show(); @@ -461,6 +464,9 @@ void tst_qquickiconimage::fileSelectors() { SKIP_IF_DPR_TOO_HIGH(); + if (QGuiApplication::platformName() == QLatin1String("offscreen")) + QSKIP("grabToImage() doesn't work on the \"offscreen\" platform plugin (QTBUG-63185)"); + QQuickView view; QQmlFileSelector* fileSelector = new QQmlFileSelector(view.engine()); fileSelector->setExtraSelectors(QStringList() << "testselector"); @@ -503,6 +509,9 @@ public: // don't crash (QTBUG-63959) void tst_qquickiconimage::imageProvider() { + if (QGuiApplication::platformName() == QLatin1String("offscreen")) + QSKIP("grabToImage() doesn't work on the \"offscreen\" platform plugin (QTBUG-63185)"); + QQuickView view; view.engine()->addImageProvider("provider", new TestImageProvider); view.setSource(testFileUrl("imageProvider.qml")); diff --git a/tests/auto/qquickiconlabel/tst_qquickiconlabel.cpp b/tests/auto/qquickiconlabel/tst_qquickiconlabel.cpp index a251b471..1f00d8e7 100644 --- a/tests/auto/qquickiconlabel/tst_qquickiconlabel.cpp +++ b/tests/auto/qquickiconlabel/tst_qquickiconlabel.cpp @@ -295,6 +295,9 @@ void tst_qquickiconlabel::emptyIconSource() void tst_qquickiconlabel::colorChanges() { + if (QGuiApplication::platformName() == QLatin1String("offscreen")) + QSKIP("grabToImage() doesn't work on the \"offscreen\" platform plugin (QTBUG-63185)"); + QQuickView view(testFileUrl("colorChanges.qml")); QCOMPARE(view.status(), QQuickView::Ready); view.show(); |