summaryrefslogtreecommitdiff
path: root/src/controls
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2014-07-28 20:37:35 +0200
committerGabriel de Dietrich <gabriel.dedietrich@digia.com>2014-07-29 13:33:21 +0200
commit5163d524dbad1d2c9f8f3cfd1d9cccbdcce98708 (patch)
treeb434456897d07d504eece24cf19caf774b63d517 /src/controls
parentacfcbd620b0ceb1f11a3fcf2439127e1558d9d01 (diff)
downloadqtquickcontrols-5163d524dbad1d2c9f8f3cfd1d9cccbdcce98708.tar.gz
QQuickPopupWindow: Use actual item size as content size
Using the children rect size was a mistake, particularly when using Instantator in a Menu. Task-number: QTBUG-40221 Change-Id: I6efe9aad617a7b0adbea0bb96bf843c5c1779131 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src/controls')
-rw-r--r--src/controls/qquickmenupopupwindow.cpp5
-rw-r--r--src/controls/qquickpopupwindow.cpp3
2 files changed, 3 insertions, 5 deletions
diff --git a/src/controls/qquickmenupopupwindow.cpp b/src/controls/qquickmenupopupwindow.cpp
index c8483d63..508b6b27 100644
--- a/src/controls/qquickmenupopupwindow.cpp
+++ b/src/controls/qquickmenupopupwindow.cpp
@@ -126,12 +126,11 @@ void QQuickMenuPopupWindow::setGeometry(int posx, int posy, int w, int h)
void QQuickMenuPopupWindow::updateSize()
{
- QSize contentSize = popupContentItem()->childrenRect().size().toSize();
qreal x = m_initialPos.x();
qreal y = m_initialPos.y();
if (qGuiApp->layoutDirection() == Qt::RightToLeft)
- x -= contentSize.width();
- setGeometry(x, y, contentSize.width(), contentSize.height());
+ x -= popupContentItem()->width();
+ setGeometry(x, y, popupContentItem()->width(), popupContentItem()->height());
}
void QQuickMenuPopupWindow::updatePosition()
diff --git a/src/controls/qquickpopupwindow.cpp b/src/controls/qquickpopupwindow.cpp
index 56f4c351..bcd2837f 100644
--- a/src/controls/qquickpopupwindow.cpp
+++ b/src/controls/qquickpopupwindow.cpp
@@ -143,8 +143,7 @@ void QQuickPopupWindow::setPopupContentItem(QQuickItem *contentItem)
void QQuickPopupWindow::updateSize()
{
- QSize contentSize = popupContentItem()->childrenRect().size().toSize();
- setGeometry(x(), y(), contentSize.width(), contentSize.height());
+ setGeometry(x(), y(), popupContentItem()->width(), popupContentItem()->height());
emit geometryChanged();
}