diff options
| author | Andreas Müller <schnitzeltony@gmail.com> | 2021-04-16 22:54:00 +0200 |
|---|---|---|
| committer | Martin Jansa <Martin.Jansa@gmail.com> | 2021-04-16 23:11:15 +0200 |
| commit | 08550c223c4528ed76d45a981aff65c8857b9195 (patch) | |
| tree | 50f37c55b5e73d5e22b80faa3f0f8e4953764a27 | |
| parent | ecdb62b1e5a83b892d1385179e71093ce22407ba (diff) | |
| download | meta-qt5-08550c223c4528ed76d45a981aff65c8857b9195.tar.gz | |
qtquickcontrols2: Fix broken Menu slipping out of screen for 2nd+ open
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
| -rw-r--r-- | recipes-qt/qt5/qtquickcontrols2/0001-Revert-Get-the-scale-of-the-popup-item-when-setting-.patch | 128 | ||||
| -rw-r--r-- | recipes-qt/qt5/qtquickcontrols2_git.bb | 2 |
2 files changed, 130 insertions, 0 deletions
diff --git a/recipes-qt/qt5/qtquickcontrols2/0001-Revert-Get-the-scale-of-the-popup-item-when-setting-.patch b/recipes-qt/qt5/qtquickcontrols2/0001-Revert-Get-the-scale-of-the-popup-item-when-setting-.patch new file mode 100644 index 00000000..a5512bbe --- /dev/null +++ b/recipes-qt/qt5/qtquickcontrols2/0001-Revert-Get-the-scale-of-the-popup-item-when-setting-.patch | |||
| @@ -0,0 +1,128 @@ | |||
| 1 | From 9fada65e1dd8958cbe4b8dc12c9e4814fcff5a6c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com> | ||
| 3 | Date: Fri, 16 Apr 2021 21:54:16 +0200 | ||
| 4 | Subject: [PATCH] Revert "Get the scale of the popup item when setting the | ||
| 5 | parent item" | ||
| 6 | |||
| 7 | Upgrade 5.14.2 (for us dunfell) -> 5.15.2 introduced a bug: Opening a menu | ||
| 8 | for the second+ time, menu moves right and down and parts land outside screen. | ||
| 9 | Reported but nobody cares. [1] | ||
| 10 | |||
| 11 | [1] https://bugreports.qt.io/browse/QTBUG-86973 | ||
| 12 | |||
| 13 | Upstream-Status: Pending | ||
| 14 | |||
| 15 | This reverts commit 761dba8b23b7e558acc57b3e481648ce319a4397. | ||
| 16 | --- | ||
| 17 | src/quicktemplates2/qquickpopuppositioner.cpp | 18 +++++++-------- | ||
| 18 | .../qquickpopuppositioner_p_p.h | 1 - | ||
| 19 | tests/auto/controls/data/tst_combobox.qml | 22 ------------------- | ||
| 20 | tests/auto/controls/data/tst_popup.qml | 3 --- | ||
| 21 | 4 files changed, 8 insertions(+), 36 deletions(-) | ||
| 22 | |||
| 23 | diff --git a/src/quicktemplates2/qquickpopuppositioner.cpp b/src/quicktemplates2/qquickpopuppositioner.cpp | ||
| 24 | index 1bfaafbe6..dbe8ac1d5 100644 | ||
| 25 | --- a/src/quicktemplates2/qquickpopuppositioner.cpp | ||
| 26 | +++ b/src/quicktemplates2/qquickpopuppositioner.cpp | ||
| 27 | @@ -92,10 +92,7 @@ void QQuickPopupPositioner::setParentItem(QQuickItem *parent) | ||
| 28 | |||
| 29 | QQuickItemPrivate::get(parent)->addItemChangeListener(this, ItemChangeTypes); | ||
| 30 | addAncestorListeners(parent->parentItem()); | ||
| 31 | - // Store the scale property so the end result of any transition that could effect the scale | ||
| 32 | - // does not influence the top left of the final popup, so it doesn't appear to flip from one | ||
| 33 | - // position to another as a result | ||
| 34 | - m_popupScale = m_popup->popupItem()->scale(); | ||
| 35 | + | ||
| 36 | if (m_popup->popupItem()->isVisible()) | ||
| 37 | QQuickPopupPrivate::get(m_popup)->reposition(); | ||
| 38 | } | ||
| 39 | @@ -111,10 +108,11 @@ void QQuickPopupPositioner::reposition() | ||
| 40 | return; | ||
| 41 | } | ||
| 42 | |||
| 43 | - const qreal w = popupItem->width() * m_popupScale; | ||
| 44 | - const qreal h = popupItem->height() * m_popupScale; | ||
| 45 | - const qreal iw = popupItem->implicitWidth() * m_popupScale; | ||
| 46 | - const qreal ih = popupItem->implicitHeight() * m_popupScale; | ||
| 47 | + const qreal scale = popupItem->scale(); | ||
| 48 | + const qreal w = popupItem->width() * scale; | ||
| 49 | + const qreal h = popupItem->height() * scale; | ||
| 50 | + const qreal iw = popupItem->implicitWidth() * scale; | ||
| 51 | + const qreal ih = popupItem->implicitHeight() * scale; | ||
| 52 | |||
| 53 | bool widthAdjusted = false; | ||
| 54 | bool heightAdjusted = false; | ||
| 55 | @@ -260,9 +258,9 @@ void QQuickPopupPositioner::reposition() | ||
| 56 | } | ||
| 57 | |||
| 58 | if (!p->hasWidth && widthAdjusted && rect.width() > 0) | ||
| 59 | - popupItem->setWidth(rect.width() / m_popupScale); | ||
| 60 | + popupItem->setWidth(rect.width() / scale); | ||
| 61 | if (!p->hasHeight && heightAdjusted && rect.height() > 0) | ||
| 62 | - popupItem->setHeight(rect.height() / m_popupScale); | ||
| 63 | + popupItem->setHeight(rect.height() / scale); | ||
| 64 | m_positioning = false; | ||
| 65 | } | ||
| 66 | |||
| 67 | diff --git a/src/quicktemplates2/qquickpopuppositioner_p_p.h b/src/quicktemplates2/qquickpopuppositioner_p_p.h | ||
| 68 | index 03a2e2fed..64f57a3fa 100644 | ||
| 69 | --- a/src/quicktemplates2/qquickpopuppositioner_p_p.h | ||
| 70 | +++ b/src/quicktemplates2/qquickpopuppositioner_p_p.h | ||
| 71 | @@ -79,7 +79,6 @@ protected: | ||
| 72 | bool m_positioning = false; | ||
| 73 | QQuickItem *m_parentItem = nullptr; | ||
| 74 | QQuickPopup *m_popup = nullptr; | ||
| 75 | - qreal m_popupScale = 1.0; | ||
| 76 | }; | ||
| 77 | |||
| 78 | QT_END_NAMESPACE | ||
| 79 | diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml | ||
| 80 | index 1c58372ff..e9156fee5 100644 | ||
| 81 | --- a/tests/auto/controls/data/tst_combobox.qml | ||
| 82 | +++ b/tests/auto/controls/data/tst_combobox.qml | ||
| 83 | @@ -911,28 +911,6 @@ TestCase { | ||
| 84 | compare(control.popup.visible, true) | ||
| 85 | verify(control.popup.contentItem.y < control.y) | ||
| 86 | |||
| 87 | - | ||
| 88 | - // Account for when a transition of a scale from 0.9-1.0 that it is placed above right away and not below | ||
| 89 | - // first just because there is room at the 0.9 scale | ||
| 90 | - if (control.popup.enter !== null) { | ||
| 91 | - // hide | ||
| 92 | - mouseClick(control) | ||
| 93 | - compare(control.pressed, false) | ||
| 94 | - tryCompare(control.popup, "visible", false) | ||
| 95 | - control.y = control.Window.height - (control.popup.contentItem.height * 0.99) | ||
| 96 | - var popupYSpy = createTemporaryObject(signalSpy, testCase, {target: control.popup, signalName: "yChanged"}) | ||
| 97 | - verify(popupYSpy.valid) | ||
| 98 | - mousePress(control) | ||
| 99 | - compare(control.pressed, true) | ||
| 100 | - compare(control.popup.visible, false) | ||
| 101 | - mouseRelease(control) | ||
| 102 | - compare(control.pressed, false) | ||
| 103 | - compare(control.popup.visible, true) | ||
| 104 | - tryCompare(control.popup.enter, "running", false) | ||
| 105 | - verify(control.popup.contentItem.y < control.y) | ||
| 106 | - verify(popupYSpy.count === 1) | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | // follow the control outside the horizontal window bounds | ||
| 110 | control.x = -control.width / 2 | ||
| 111 | compare(control.x, -control.width / 2) | ||
| 112 | diff --git a/tests/auto/controls/data/tst_popup.qml b/tests/auto/controls/data/tst_popup.qml | ||
| 113 | index 57d5ccccf..71d6f2d76 100644 | ||
| 114 | --- a/tests/auto/controls/data/tst_popup.qml | ||
| 115 | +++ b/tests/auto/controls/data/tst_popup.qml | ||
| 116 | @@ -1276,9 +1276,6 @@ TestCase { | ||
| 117 | { visible: true, width: 100, height: 100 }) | ||
| 118 | verify(control) | ||
| 119 | verify(control.visible) | ||
| 120 | - // If there is a transition then make sure it is finished | ||
| 121 | - if (control.enter !== null) | ||
| 122 | - tryCompare(control.enter, "running", false) | ||
| 123 | compare(control.parent, control.Overlay.overlay) | ||
| 124 | compare(control.x, 0) | ||
| 125 | compare(control.y, 0) | ||
| 126 | -- | ||
| 127 | 2.26.2 | ||
| 128 | |||
diff --git a/recipes-qt/qt5/qtquickcontrols2_git.bb b/recipes-qt/qt5/qtquickcontrols2_git.bb index fed17dad..87e79f3a 100644 --- a/recipes-qt/qt5/qtquickcontrols2_git.bb +++ b/recipes-qt/qt5/qtquickcontrols2_git.bb | |||
| @@ -10,4 +10,6 @@ LIC_FILES_CHKSUM = " \ | |||
| 10 | 10 | ||
| 11 | DEPENDS += "qtdeclarative qtdeclarative-native" | 11 | DEPENDS += "qtdeclarative qtdeclarative-native" |
| 12 | 12 | ||
| 13 | SRC_URI += "file://0001-Revert-Get-the-scale-of-the-popup-item-when-setting-.patch" | ||
| 14 | |||
| 13 | SRCREV = "16f27dfa3588c2bf377568ce00bf534af48c9558" | 15 | SRCREV = "16f27dfa3588c2bf377568ce00bf534af48c9558" |
