aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickpopup.cpp
diff options
context:
space:
mode:
authorNikita Krupenko <krnekit@gmail.com>2016-05-16 07:58:48 +0300
committerNikita Krupenko <krnekit@gmail.com>2016-05-18 13:57:23 +0000
commit145ba3fd216b1d77331ef239f957360e03432d44 (patch)
tree382c0b54682d46967e515c7362b14bb395704f6e /src/quicktemplates2/qquickpopup.cpp
parent66129d45ffae848dead6e05d307789216c2f51cf (diff)
Popup: restore original size on reposition if appropriate
When popup need to reposition (for example, on screen orientation change), it's resized to fit into window bounds. But if the implicit size of it's content changed to accommodate window geometry, popup wouldn't change it's size back. This commit allow to change popup size when implicit width of the content changed and new size could fit into window bounds. Task-number: QTBUG-52729 Change-Id: I5a265b55e24495be9c1f2050cdcceddcdeb57974 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickpopup.cpp')
-rw-r--r--src/quicktemplates2/qquickpopup.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index de29e605..6d969e30 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -609,6 +609,11 @@ void QQuickPopupPrivate::reposition()
rect.setRight(bounds.right());
widthAdjusted = true;
}
+ } else if (iw > 0 && rect.left() >= bounds.left() && rect.right() <= bounds.right()
+ && iw != w) {
+ // restore original width
+ rect.setWidth(iw);
+ widthAdjusted = true;
}
if (ih > 0 && (rect.top() < bounds.top() || rect.bottom() > bounds.bottom())) {
@@ -628,6 +633,11 @@ void QQuickPopupPrivate::reposition()
rect.setBottom(bounds.bottom());
heightAdjusted = true;
}
+ } else if (ih > 0 && rect.top() >= bounds.top() && rect.bottom() <= bounds.bottom()
+ && ih != h) {
+ // restore original height
+ rect.setHeight(ih);
+ heightAdjusted = true;
}
}
}