forked from qt-creator/qt-creator
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>
This commit is contained in:
committed by
Mahmoud Badri
parent
243e473b4c
commit
f2b2f488e2
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user