aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/quicktemplates2/qquickpopuppositioner.cpp18
-rw-r--r--src/quicktemplates2/qquickpopuppositioner_p_p.h1
2 files changed, 11 insertions, 8 deletions
diff --git a/src/quicktemplates2/qquickpopuppositioner.cpp b/src/quicktemplates2/qquickpopuppositioner.cpp
index dbe8ac1d..1bfaafbe 100644
--- a/src/quicktemplates2/qquickpopuppositioner.cpp
+++ b/src/quicktemplates2/qquickpopuppositioner.cpp
@@ -92,7 +92,10 @@ void QQuickPopupPositioner::setParentItem(QQuickItem *parent)
QQuickItemPrivate::get(parent)->addItemChangeListener(this, ItemChangeTypes);
addAncestorListeners(parent->parentItem());
-
+ // Store the scale property so the end result of any transition that could effect the scale
+ // does not influence the top left of the final popup, so it doesn't appear to flip from one
+ // position to another as a result
+ m_popupScale = m_popup->popupItem()->scale();
if (m_popup->popupItem()->isVisible())
QQuickPopupPrivate::get(m_popup)->reposition();
}
@@ -108,11 +111,10 @@ void QQuickPopupPositioner::reposition()
return;
}
- const qreal scale = popupItem->scale();
- const qreal w = popupItem->width() * scale;
- const qreal h = popupItem->height() * scale;
- const qreal iw = popupItem->implicitWidth() * scale;
- const qreal ih = popupItem->implicitHeight() * scale;
+ const qreal w = popupItem->width() * m_popupScale;
+ const qreal h = popupItem->height() * m_popupScale;
+ const qreal iw = popupItem->implicitWidth() * m_popupScale;
+ const qreal ih = popupItem->implicitHeight() * m_popupScale;
bool widthAdjusted = false;
bool heightAdjusted = false;
@@ -258,9 +260,9 @@ void QQuickPopupPositioner::reposition()
}
if (!p->hasWidth && widthAdjusted && rect.width() > 0)
- popupItem->setWidth(rect.width() / scale);
+ popupItem->setWidth(rect.width() / m_popupScale);
if (!p->hasHeight && heightAdjusted && rect.height() > 0)
- popupItem->setHeight(rect.height() / scale);
+ popupItem->setHeight(rect.height() / m_popupScale);
m_positioning = false;
}
diff --git a/src/quicktemplates2/qquickpopuppositioner_p_p.h b/src/quicktemplates2/qquickpopuppositioner_p_p.h
index 64f57a3f..03a2e2fe 100644
--- a/src/quicktemplates2/qquickpopuppositioner_p_p.h
+++ b/src/quicktemplates2/qquickpopuppositioner_p_p.h
@@ -79,6 +79,7 @@ protected:
bool m_positioning = false;
QQuickItem *m_parentItem = nullptr;
QQuickPopup *m_popup = nullptr;
+ qreal m_popupScale = 1.0;
};
QT_END_NAMESPACE