129 lines
5.4 KiB
Diff
129 lines
5.4 KiB
Diff
|
From 9fada65e1dd8958cbe4b8dc12c9e4814fcff5a6c Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
|
||
|
Date: Fri, 16 Apr 2021 21:54:16 +0200
|
||
|
Subject: [PATCH] Revert "Get the scale of the popup item when setting the
|
||
|
parent item"
|
||
|
|
||
|
Upgrade 5.14.2 (for us dunfell) -> 5.15.2 introduced a bug: Opening a menu
|
||
|
for the second+ time, menu moves right and down and parts land outside screen.
|
||
|
Reported but nobody cares. [1]
|
||
|
|
||
|
[1] https://bugreports.qt.io/browse/QTBUG-86973
|
||
|
|
||
|
Upstream-Status: Pending
|
||
|
|
||
|
This reverts commit 761dba8b23b7e558acc57b3e481648ce319a4397.
|
||
|
---
|
||
|
src/quicktemplates2/qquickpopuppositioner.cpp | 18 +++++++--------
|
||
|
.../qquickpopuppositioner_p_p.h | 1 -
|
||
|
tests/auto/controls/data/tst_combobox.qml | 22 -------------------
|
||
|
tests/auto/controls/data/tst_popup.qml | 3 ---
|
||
|
4 files changed, 8 insertions(+), 36 deletions(-)
|
||
|
|
||
|
diff --git a/src/quicktemplates2/qquickpopuppositioner.cpp b/src/quicktemplates2/qquickpopuppositioner.cpp
|
||
|
index 1bfaafbe6..dbe8ac1d5 100644
|
||
|
--- a/src/quicktemplates2/qquickpopuppositioner.cpp
|
||
|
+++ b/src/quicktemplates2/qquickpopuppositioner.cpp
|
||
|
@@ -92,10 +92,7 @@ void QQuickPopupPositioner::setParentItem(QQuickItem *parent)
|
||
|
|
||
|
QQuickItemPrivate::get(parent)->addItemChangeListener(this, ItemChangeTypes);
|
||
|
addAncestorListeners(parent->parentItem());
|
||
|
- // Store the scale property so the end result of any transition that could effect the scale
|
||
|
- // does not influence the top left of the final popup, so it doesn't appear to flip from one
|
||
|
- // position to another as a result
|
||
|
- m_popupScale = m_popup->popupItem()->scale();
|
||
|
+
|
||
|
if (m_popup->popupItem()->isVisible())
|
||
|
QQuickPopupPrivate::get(m_popup)->reposition();
|
||
|
}
|
||
|
@@ -111,10 +108,11 @@ void QQuickPopupPositioner::reposition()
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
- const qreal w = popupItem->width() * m_popupScale;
|
||
|
- const qreal h = popupItem->height() * m_popupScale;
|
||
|
- const qreal iw = popupItem->implicitWidth() * m_popupScale;
|
||
|
- const qreal ih = popupItem->implicitHeight() * m_popupScale;
|
||
|
+ const qreal scale = popupItem->scale();
|
||
|
+ const qreal w = popupItem->width() * scale;
|
||
|
+ const qreal h = popupItem->height() * scale;
|
||
|
+ const qreal iw = popupItem->implicitWidth() * scale;
|
||
|
+ const qreal ih = popupItem->implicitHeight() * scale;
|
||
|
|
||
|
bool widthAdjusted = false;
|
||
|
bool heightAdjusted = false;
|
||
|
@@ -260,9 +258,9 @@ void QQuickPopupPositioner::reposition()
|
||
|
}
|
||
|
|
||
|
if (!p->hasWidth && widthAdjusted && rect.width() > 0)
|
||
|
- popupItem->setWidth(rect.width() / m_popupScale);
|
||
|
+ popupItem->setWidth(rect.width() / scale);
|
||
|
if (!p->hasHeight && heightAdjusted && rect.height() > 0)
|
||
|
- popupItem->setHeight(rect.height() / m_popupScale);
|
||
|
+ popupItem->setHeight(rect.height() / scale);
|
||
|
m_positioning = false;
|
||
|
}
|
||
|
|
||
|
diff --git a/src/quicktemplates2/qquickpopuppositioner_p_p.h b/src/quicktemplates2/qquickpopuppositioner_p_p.h
|
||
|
index 03a2e2fed..64f57a3fa 100644
|
||
|
--- a/src/quicktemplates2/qquickpopuppositioner_p_p.h
|
||
|
+++ b/src/quicktemplates2/qquickpopuppositioner_p_p.h
|
||
|
@@ -79,7 +79,6 @@ protected:
|
||
|
bool m_positioning = false;
|
||
|
QQuickItem *m_parentItem = nullptr;
|
||
|
QQuickPopup *m_popup = nullptr;
|
||
|
- qreal m_popupScale = 1.0;
|
||
|
};
|
||
|
|
||
|
QT_END_NAMESPACE
|
||
|
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
|
||
|
index 1c58372ff..e9156fee5 100644
|
||
|
--- a/tests/auto/controls/data/tst_combobox.qml
|
||
|
+++ b/tests/auto/controls/data/tst_combobox.qml
|
||
|
@@ -911,28 +911,6 @@ TestCase {
|
||
|
compare(control.popup.visible, true)
|
||
|
verify(control.popup.contentItem.y < control.y)
|
||
|
|
||
|
-
|
||
|
- // Account for when a transition of a scale from 0.9-1.0 that it is placed above right away and not below
|
||
|
- // first just because there is room at the 0.9 scale
|
||
|
- if (control.popup.enter !== null) {
|
||
|
- // hide
|
||
|
- mouseClick(control)
|
||
|
- compare(control.pressed, false)
|
||
|
- tryCompare(control.popup, "visible", false)
|
||
|
- control.y = control.Window.height - (control.popup.contentItem.height * 0.99)
|
||
|
- var popupYSpy = createTemporaryObject(signalSpy, testCase, {target: control.popup, signalName: "yChanged"})
|
||
|
- verify(popupYSpy.valid)
|
||
|
- mousePress(control)
|
||
|
- compare(control.pressed, true)
|
||
|
- compare(control.popup.visible, false)
|
||
|
- mouseRelease(control)
|
||
|
- compare(control.pressed, false)
|
||
|
- compare(control.popup.visible, true)
|
||
|
- tryCompare(control.popup.enter, "running", false)
|
||
|
- verify(control.popup.contentItem.y < control.y)
|
||
|
- verify(popupYSpy.count === 1)
|
||
|
- }
|
||
|
-
|
||
|
// follow the control outside the horizontal window bounds
|
||
|
control.x = -control.width / 2
|
||
|
compare(control.x, -control.width / 2)
|
||
|
diff --git a/tests/auto/controls/data/tst_popup.qml b/tests/auto/controls/data/tst_popup.qml
|
||
|
index 57d5ccccf..71d6f2d76 100644
|
||
|
--- a/tests/auto/controls/data/tst_popup.qml
|
||
|
+++ b/tests/auto/controls/data/tst_popup.qml
|
||
|
@@ -1276,9 +1276,6 @@ TestCase {
|
||
|
{ visible: true, width: 100, height: 100 })
|
||
|
verify(control)
|
||
|
verify(control.visible)
|
||
|
- // If there is a transition then make sure it is finished
|
||
|
- if (control.enter !== null)
|
||
|
- tryCompare(control.enter, "running", false)
|
||
|
compare(control.parent, control.Overlay.overlay)
|
||
|
compare(control.x, 0)
|
||
|
compare(control.y, 0)
|
||
|
--
|
||
|
2.26.2
|
||
|
|