aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2022-09-30 16:33:53 +0300
committerMahmoud Badri <mahmoud.badri@qt.io>2022-09-30 14:55:05 +0000
commitf2b2f488e271f8ad607cfb90ae8aff6f3951291a (patch)
tree3be38cacd913c809125eb4a041403218d00eb8af
parent243e473b4ccc8686910e30e13a3b89ada2815e86 (diff)
QmlDesigner: Fix mouse position on material browser to 3d editor drag
The mouse position from Edit3DWidget needs to be mapped to Edit3DCanvas before resolving the 3d position. Fixes: QDS-7840 Change-Id: I85bc1e9268d6f683382a5431997263429ea13470 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
-rw-r--r--src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp
index 30b8894bbe..e05c3dd10a 100644
--- a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp
+++ b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp
@@ -339,6 +339,8 @@ void Edit3DWidget::dragEnterEvent(QDragEnterEvent *dragEnterEvent)
void Edit3DWidget::dropEvent(QDropEvent *dropEvent)
{
+ const QPointF pos = m_canvas->mapFrom(this, dropEvent->position());
+
// handle dropping materials
if (dropEvent->mimeData()->hasFormat(Constants::MIME_TYPE_MATERIAL)) {
QByteArray data = dropEvent->mimeData()->data(Constants::MIME_TYPE_MATERIAL);
@@ -348,13 +350,13 @@ void Edit3DWidget::dropEvent(QDropEvent *dropEvent)
ModelNode matNode = m_view->modelNodeForInternalId(internalId);
if (matNode.isValid())
- m_view->dropMaterial(matNode, dropEvent->position());
+ m_view->dropMaterial(matNode, pos);
return;
}
// handle dropping bundle materials
if (dropEvent->mimeData()->hasFormat(Constants::MIME_TYPE_BUNDLE_MATERIAL)) {
- m_view->dropBundleMaterial(dropEvent->position());
+ m_view->dropBundleMaterial(pos);
return;
}