diff options
Diffstat (limited to 'src/quicktemplates2/qquickpopuppositioner.cpp')
-rw-r--r-- | src/quicktemplates2/qquickpopuppositioner.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/quicktemplates2/qquickpopuppositioner.cpp b/src/quicktemplates2/qquickpopuppositioner.cpp index e247ea6556..bbdc3848cd 100644 --- a/src/quicktemplates2/qquickpopuppositioner.cpp +++ b/src/quicktemplates2/qquickpopuppositioner.cpp @@ -162,14 +162,18 @@ void QQuickPopupPositioner::reposition() // if the popup doesn't fit horizontally inside the window, try flipping it around (left <-> right) if (p->allowHorizontalFlip && (rect.left() < bounds.left() || rect.right() > bounds.right())) { - const QRectF flipped(m_parentItem->mapToScene(QPointF(m_parentItem->width() - p->x - rect.width(), p->y)), rect.size()); + const QPointF newTopLeft(m_parentItem->width() - p->x - rect.width(), p->y); + const QRectF flipped(m_parentItem->mapToItem(popupItem->parentItem(), newTopLeft), + rect.size()); if (flipped.intersected(bounds).width() > rect.intersected(bounds).width()) rect.moveLeft(flipped.left()); } // if the popup doesn't fit vertically inside the window, try flipping it around (above <-> below) if (p->allowVerticalFlip && (rect.top() < bounds.top() || rect.bottom() > bounds.bottom())) { - const QRectF flipped(m_parentItem->mapToScene(QPointF(p->x, m_parentItem->height() - p->y - rect.height())), rect.size()); + const QPointF newTopLeft(p->x, m_parentItem->height() - p->y - rect.height()); + const QRectF flipped(m_parentItem->mapToItem(popupItem->parentItem(), newTopLeft), + rect.size()); if (flipped.intersected(bounds).height() > rect.intersected(bounds).height()) rect.moveTop(flipped.top()); } |