aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2022-05-18 16:49:42 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2022-05-18 14:17:36 +0000
commit6df6475ccdc144eeccaf2991e7294fa6a0787460 (patch)
treecbafd3a8816e9776a0dbe2bc4b531fb04daf1daa
parent6dda55a8cd16857d1d50d22a4ff36d147905eaf0 (diff)
QmlDesigner: Fix initial form editor scroll/zoom for 3D previews
Preview item was initialized to zero size rect and form editor view scroll/zoom was not updated when size was corrected later as preview image was received. Since we use fixed size preview images, we can initialize the preview item to that size to fix the issue. Change-Id: I8198af1b830498f6540a783d770abdfb8a8860f4 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
index 4146b06648..14dee1dd70 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
@@ -2230,11 +2230,12 @@ void FormEditor3dPreview::updateGeometry()
{
prepareGeometryChange();
- m_selectionBoundingRect = qmlItemNode().instanceBoundingRect().adjusted(0, 0, 1., 1.);
m_boundingRect = qmlItemNode().instanceBoundingRect();
+ if (m_boundingRect.isEmpty())
+ m_boundingRect = {0, 0, 640, 480}; // Init to default size so initial view is correct
+ m_selectionBoundingRect = m_boundingRect.adjusted(0, 0, 1., 1.);
m_paintedBoundingRect = m_boundingRect;
setTransform(QTransform());
-
}
QPointF FormEditor3dPreview::instancePosition() const