aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-30 03:01:47 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-30 03:01:47 +0100
commitd8981425c33f3bae930f31fbb2cf804c7337f33a (patch)
tree98c5c6dc914bb39d049544916a6db80bb3005300
parent1b2e0d509ed8df858a621908936114544cddc55f (diff)
parentd9b0e2cde72824d19fb8ef6dfffd8cceb53957a3 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp19
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp5
-rw-r--r--tests/auto/controls/data/tst_dialogbuttonbox.qml29
3 files changed, 47 insertions, 6 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index ffdb7cc2..03dd6086 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -1556,8 +1556,13 @@ bool QQuickComboBox::eventFilter(QObject *object, QEvent *event)
break;
}
case QEvent::FocusOut:
- d->hidePopup(false);
- setPressed(false);
+ if (qGuiApp->focusObject() != this) {
+ // Only close the popup if focus was transferred somewhere else
+ // than to the popup button (which normally means that the user
+ // clicked on the popup button to open it, not close it.
+ d->hidePopup(false);
+ setPressed(false);
+ }
break;
#if QT_CONFIG(im)
case QEvent::InputMethod:
@@ -1583,8 +1588,14 @@ void QQuickComboBox::focusOutEvent(QFocusEvent *event)
{
Q_D(QQuickComboBox);
QQuickControl::focusOutEvent(event);
- d->hidePopup(false);
- setPressed(false);
+
+ if (qGuiApp->focusObject() != d->contentItem) {
+ // Only close the popup if focus was transferred
+ // somewhere else than to the inner line edit (which is
+ // normally done from QQuickComboBox::focusInEvent).
+ d->hidePopup(false);
+ setPressed(false);
+ }
}
#if QT_CONFIG(im)
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
index 03f5f8e8..91fb41f2 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox.cpp
+++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp
@@ -295,6 +295,7 @@ void QQuickDialogButtonBoxPrivate::updateLayout()
if (firstRole != secondRole && firstRole != QPlatformDialogHelper::InvalidRole && secondRole != QPlatformDialogHelper::InvalidRole) {
const int *l = m_layout;
while (*l != QPlatformDialogHelper::EOL) {
+ // Unset the Reverse flag.
const int role = (*l & ~QPlatformDialogHelper::Reverse);
if (role == firstRole)
return true;
@@ -305,14 +306,14 @@ void QQuickDialogButtonBoxPrivate::updateLayout()
}
if (firstRole == secondRole)
- return first < second;
+ return false;
return firstRole != QPlatformDialogHelper::InvalidRole;
}
const int *m_layout;
};
- std::sort(buttons.begin(), buttons.end(), ButtonLayout(static_cast<QPlatformDialogHelper::ButtonLayout>(buttonLayout)));
+ std::stable_sort(buttons.begin(), buttons.end(), ButtonLayout(static_cast<QPlatformDialogHelper::ButtonLayout>(buttonLayout)));
for (int i = 0; i < buttons.count() - 1; ++i)
q->insertItem(i, buttons.at(i));
diff --git a/tests/auto/controls/data/tst_dialogbuttonbox.qml b/tests/auto/controls/data/tst_dialogbuttonbox.qml
index 6eca8569..374b32ff 100644
--- a/tests/auto/controls/data/tst_dialogbuttonbox.qml
+++ b/tests/auto/controls/data/tst_dialogbuttonbox.qml
@@ -424,4 +424,33 @@ TestCase {
1000, "Expected right edge of button to be within right edge of DialogButtonBox (i.e. less than or equal to " +
control.width + "), but it's " + (button.mapToItem(control, 0, 0).x + button.width))
}
+
+
+ Component {
+ id: noRolesDialog
+
+ Dialog {
+ footer: DialogButtonBox {
+ Button { text: "A" }
+ Button { text: "B" }
+ Button { text: "C" }
+ }
+ }
+ }
+
+ function test_orderWithNoRoles() {
+ for (var i = 0; i < 10; ++i) {
+ var control = createTemporaryObject(noRolesDialog, testCase)
+ verify(control)
+
+ control.open()
+ tryCompare(control, "opened", true)
+ var footer = control.footer
+ verify(footer)
+ waitForRendering(footer)
+ compare(footer.itemAt(0).text, "A")
+ compare(footer.itemAt(1).text, "B")
+ compare(footer.itemAt(2).text, "C")
+ }
+ }
}