From 6e53de99b0d75063a6892f64f2e0d9f6a3105375 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 4 Mar 2016 18:54:06 +0400 Subject: [PATCH 1/4] Fix typo in the Pane style Frame derives the Pane, not vice versa. Change-Id: I1a2bf0834efb44da7be21ded8aab01bafc42631f Reviewed-by: J-P Nurmi --- src/imports/controls/Pane.qml | 2 +- src/imports/controls/material/Pane.qml | 2 +- src/imports/controls/universal/Pane.qml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/imports/controls/Pane.qml b/src/imports/controls/Pane.qml index fbbe0c38f3..7b95cd8a40 100644 --- a/src/imports/controls/Pane.qml +++ b/src/imports/controls/Pane.qml @@ -37,7 +37,7 @@ import QtQuick 2.6 import Qt.labs.templates 1.0 as T -T.Frame { +T.Pane { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) diff --git a/src/imports/controls/material/Pane.qml b/src/imports/controls/material/Pane.qml index 5f48aaf822..b936f08f32 100644 --- a/src/imports/controls/material/Pane.qml +++ b/src/imports/controls/material/Pane.qml @@ -38,7 +38,7 @@ import QtQuick 2.6 import Qt.labs.templates 1.0 as T import Qt.labs.controls.material 1.0 -T.Frame { +T.Pane { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) diff --git a/src/imports/controls/universal/Pane.qml b/src/imports/controls/universal/Pane.qml index c0f8707566..138b4ad4eb 100644 --- a/src/imports/controls/universal/Pane.qml +++ b/src/imports/controls/universal/Pane.qml @@ -38,7 +38,7 @@ import QtQuick 2.6 import Qt.labs.templates 1.0 as T import Qt.labs.controls.universal 1.0 -T.Frame { +T.Pane { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) From 28a94cd2d48c97b813265367a163544ac26c2063 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 4 Mar 2016 16:03:14 +0100 Subject: [PATCH 2/4] ComboBox: fix activation The highlighted index is always -1 when the popup is hidden. Thus, when pressing enter/return, it should only activate the highlighted index when the popup is visible to avoid setting the current index to -1. Change-Id: I7a66e347bf2e4b62a67eb39b119ca1de299f16ef Task-number: QTBUG-51645 Reviewed-by: Mitch Curtis --- src/templates/qquickcombobox.cpp | 2 +- tests/auto/controls/data/tst_combobox.qml | 35 +++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/templates/qquickcombobox.cpp b/src/templates/qquickcombobox.cpp index 229201c50f..e37b0f5218 100644 --- a/src/templates/qquickcombobox.cpp +++ b/src/templates/qquickcombobox.cpp @@ -755,7 +755,7 @@ void QQuickComboBox::keyReleaseEvent(QKeyEvent *event) break; case Qt::Key_Enter: case Qt::Key_Return: - d->hidePopup(true); + d->hidePopup(d->isPopupVisible()); setPressed(false); event->accept(); break; diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index b112f20c49..901b24248c 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -717,4 +717,39 @@ TestCase { control.destroy() } + + function test_activation_data() { + return [ + { tag: "open:enter", key: Qt.Key_Enter, open: true }, + { tag: "open:return", key: Qt.Key_Return, open: true }, + { tag: "closed:enter", key: Qt.Key_Enter, open: false }, + { tag: "closed:return", key: Qt.Key_Return, open: false } + ] + } + + // QTBUG-51645 + function test_activation(data) { + var control = comboBox.createObject(window.contentItem, {currentIndex: 1, model: ["Apple", "Orange", "Banana"]}) + verify(control) + + waitForRendering(control) + control.forceActiveFocus() + verify(control.activeFocus) + + if (data.open) + keyClick(Qt.Key_Space) + compare(control.popup.visible, data.open) + + compare(control.currentIndex, 1) + compare(control.currentText, "Orange") + compare(control.displayText, "Orange") + + keyClick(data.key) + + compare(control.currentIndex, 1) + compare(control.currentText, "Orange") + compare(control.displayText, "Orange") + + control.destroy() + } } From a055629f43cf8589ff6d69e46b2610429aaa4167 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 4 Mar 2016 16:32:52 +0100 Subject: [PATCH 3/4] SwipeView: cull items outside the view This hides them until they become visible in the view. Hiding them explicitly is not an option, because then they will never show up. This technique is used in QQuickItemView::initItem() and FxViewItem::setVisible(). Change-Id: I3a3779e11a57c6dcf94ffc834f6e920449aea74a Task-number: QTBUG-51078 Task-number: QTBUG-51669 Reviewed-by: Mitch Curtis --- src/templates/qquickswipeview.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/templates/qquickswipeview.cpp b/src/templates/qquickswipeview.cpp index c33163fecd..f807439b2d 100644 --- a/src/templates/qquickswipeview.cpp +++ b/src/templates/qquickswipeview.cpp @@ -142,6 +142,7 @@ void QQuickSwipeView::geometryChanged(const QRectF &newGeometry, const QRectF &o void QQuickSwipeView::itemAdded(int, QQuickItem *item) { Q_D(QQuickSwipeView); + QQuickItemPrivate::get(item)->setCulled(true); // QTBUG-51078, QTBUG-51669 if (isComponentComplete()) item->setSize(QSizeF(d->contentItem->width(), d->contentItem->height())); } From 01d076d0e81e5d8825fcdc16544f826530bd5ace Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 7 Mar 2016 13:24:13 +0100 Subject: [PATCH 4/4] Fix static builds The error was: Error in '.rcc\debug\qmake_Qt_labs_controls.qrc': Cannot find file 'C:/dev/qt5.7/qtquickcontrols2/src/imports/controls/designer/images/*.png' Change-Id: Icfd1225e8c130d8d48f821af981b64202c687956 Task-number: QTBUG-51708 Reviewed-by: J-P Nurmi --- src/imports/controls/controls.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/imports/controls/controls.pro b/src/imports/controls/controls.pro index b5c258ebef..a986161793 100644 --- a/src/imports/controls/controls.pro +++ b/src/imports/controls/controls.pro @@ -25,7 +25,7 @@ RESOURCES += \ $$PWD/qtlabscontrolsplugin.qrc include(controls.pri) -!ios: include(designer/designer.pri) +!static: include(designer/designer.pri) CONFIG += no_cxx_module load(qml_plugin)