From 22624517ccbe780937ec2ba0b4264b71e38484bb Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 24 Feb 2016 15:13:37 +0100 Subject: Fix QQuickPopup to respect explicit size Don't resize the popup (clamping to its implicit size) unless the popup really has to be resized in order to fit the screen. Change-Id: I81201b77a1001ac22291ede1fc685f7208ff2916 Task-number: QTBUG-51322 Reviewed-by: Mitch Curtis --- src/templates/qquickpopup.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/templates') diff --git a/src/templates/qquickpopup.cpp b/src/templates/qquickpopup.cpp index 18a11208..0a9d9499 100644 --- a/src/templates/qquickpopup.cpp +++ b/src/templates/qquickpopup.cpp @@ -471,6 +471,7 @@ void QQuickPopupPositioner::repositionPopup() const qreal iw = m_popup->popupItem->implicitWidth(); const qreal ih = m_popup->popupItem->implicitHeight(); + bool adjusted = false; QRectF rect(m_x, m_y, iw > 0 ? iw : w, ih > 0 ? ih : h); if (m_parentItem) { rect = m_parentItem->mapRectToScene(rect); @@ -482,6 +483,7 @@ void QQuickPopupPositioner::repositionPopup() // if the popup doesn't fit inside the window, try flipping it around (below <-> above) const QRectF flipped = m_parentItem->mapRectToScene(QRectF(m_x, m_parentItem->height() - m_y - rect.height(), rect.width(), rect.height())); if (flipped.top() >= bounds.top() && flipped.bottom() < bounds.bottom()) { + adjusted = true; rect = flipped; } else if (ih > 0) { // neither the flipped around geometry fits inside the window, choose @@ -496,13 +498,14 @@ void QQuickPopupPositioner::repositionPopup() rect.setY(secondary.y()); rect.setHeight(secondary.height()); } + adjusted = true; } } } } m_popup->popupItem->setPosition(rect.topLeft()); - if (ih > 0) + if (adjusted && ih > 0) m_popup->popupItem->setHeight(rect.height()); } -- cgit v1.2.3