aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-24 15:13:37 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-24 15:13:36 +0000
commit22624517ccbe780937ec2ba0b4264b71e38484bb (patch)
tree670113a73de4bca1af1375505d0ca11760185ae7 /src/templates
parent8a4db8ec31426a3ca2697ec868f566ba43bbe597 (diff)
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 <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/templates')
-rw-r--r--src/templates/qquickpopup.cpp5
1 files changed, 4 insertions, 1 deletions
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());
}