aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/qquickpopup.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-01-30 10:45:28 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-01-30 15:26:35 +0000
commit165578534d9b1a0e09f4374852ad12bd153a6889 (patch)
tree13b04969e620dfd3572f2aa0422e2f5f9a12fa22 /src/templates/qquickpopup.cpp
parent3d246f823273518b594c17c17827ce165fd116e1 (diff)
Popup: improve positioning
Don't spend time repositioning while hidden, but make sure to reposition when the popup item is resized, or when the popup itself becomes visible. This fixes the issue that a ComboBox popup wasn't positioned inside the window when shown initially, until the ComboBox itself moved. Change-Id: I1456dc647e35b6eb9ec2c60dbe9bc9229f932e24 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/templates/qquickpopup.cpp')
-rw-r--r--src/templates/qquickpopup.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/templates/qquickpopup.cpp b/src/templates/qquickpopup.cpp
index 2db7488c..b1987b25 100644
--- a/src/templates/qquickpopup.cpp
+++ b/src/templates/qquickpopup.cpp
@@ -323,7 +323,8 @@ void QQuickPopupPositioner::setX(qreal x)
{
if (m_x != x) {
m_x = x;
- repositionPopup();
+ if (m_popup->overlay) // isVisible
+ repositionPopup();
}
}
@@ -336,7 +337,8 @@ void QQuickPopupPositioner::setY(qreal y)
{
if (m_y != y) {
m_y = y;
- repositionPopup();
+ if (m_popup->overlay) // isVisible
+ repositionPopup();
}
}
@@ -363,12 +365,14 @@ void QQuickPopupPositioner::setParentItem(QQuickItem *parent)
QQuickItemPrivate::get(parent)->addItemChangeListener(this, ItemChangeTypes);
addAncestorListeners(parent->parentItem());
- repositionPopup();
+ if (m_popup->overlay) // isVisible
+ repositionPopup();
}
void QQuickPopupPositioner::itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &)
{
- repositionPopup();
+ if (m_popup->overlay) // isVisible
+ repositionPopup();
}
void QQuickPopupPositioner::itemParentChanged(QQuickItem *, QQuickItem *parent)
@@ -1295,6 +1299,7 @@ void QQuickPopup::geometryChanged(const QRectF &newGeometry, const QRectF &oldGe
Q_D(QQuickPopup);
d->resizeBackground();
d->resizeContent();
+ d->positioner.repositionPopup();
if (!qFuzzyCompare(newGeometry.width(), oldGeometry.width())) {
emit widthChanged();
emit availableWidthChanged();