diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2023-02-23 16:31:07 +0200 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2023-02-24 09:03:40 +0000 |
commit | d3d621a7b30cf2a250a6877e828b0794322bd4d8 (patch) | |
tree | 620cb0e1b2a8c45d7ad317f36188f405145f3db8 | |
parent | 2af1e5b3b268a4c0fa0308cdb95cb80480df5275 (diff) | |
download | qt-creator-d3d621a7b30cf2a250a6877e828b0794322bd4d8.tar.gz |
QmlDesigner: End drag properly in assets and material browser views
If drag is accepted but drag ending is not notified to model, other
views will not know the drag has ended.
Fixes: QDS-9254
Change-Id: I1446bd4b52ce67afc37194c98e5c60e169fb57b9
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
4 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/qmldesigner/components/assetslibrary/assetslibraryview.cpp b/src/plugins/qmldesigner/components/assetslibrary/assetslibraryview.cpp index 17d8da5bb2..3ed096689e 100644 --- a/src/plugins/qmldesigner/components/assetslibrary/assetslibraryview.cpp +++ b/src/plugins/qmldesigner/components/assetslibrary/assetslibraryview.cpp @@ -70,10 +70,15 @@ WidgetInfo AssetsLibraryView::widgetInfo() }); }); - connect(m_widget, &AssetsLibraryWidget::hasMaterialLibraryUpdateRequested, this, [&] () { + connect(m_widget, &AssetsLibraryWidget::hasMaterialLibraryUpdateRequested, this, [&]() { m_widget->setHasMaterialLibrary(model() && materialLibraryNode().isValid() && model()->hasImport("QtQuick3D")); }); + + connect(m_widget, &AssetsLibraryWidget::endDrag, this, [&]() { + if (model()) + model()->endDrag(); + }); } return createWidgetInfo(m_widget.data(), "Assets", WidgetInfo::LeftPane, 0, tr("Assets")); diff --git a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp index 9f9fde4992..33abbbc5dd 100644 --- a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp @@ -311,6 +311,8 @@ void AssetsLibraryWidget::handleExtFilesDrop(const QList<QUrl> &simpleFilePaths, if (!complexFilePathStrings.empty()) addResources(complexFilePathStrings); + + emit endDrag(); } QSet<QString> AssetsLibraryWidget::supportedAssetSuffixes(bool complex) diff --git a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.h b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.h index 24be02b2e2..f6d20dc311 100644 --- a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.h +++ b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.h @@ -108,6 +108,7 @@ signals: void hasMaterialLibraryUpdateRequested(); void hasMaterialLibraryChanged(); void isDraggingChanged(); + void endDrag(); protected: bool eventFilter(QObject *obj, QEvent *event) override; diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp index 76944eeb22..2f48fc1b73 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp @@ -267,11 +267,15 @@ void MaterialBrowserWidget::startDragTexture(int index, const QPointF &mousePos) void MaterialBrowserWidget::acceptBundleMaterialDrop() { m_materialBrowserView->emitCustomNotification("drop_bundle_material", {}, {}); // To ContentLibraryView + if (m_materialBrowserView->model()) + m_materialBrowserView->model()->endDrag(); } void MaterialBrowserWidget::acceptBundleTextureDrop() { m_materialBrowserView->emitCustomNotification("drop_bundle_texture", {}, {}); // To ContentLibraryView + if (m_materialBrowserView->model()) + m_materialBrowserView->model()->endDrag(); } void MaterialBrowserWidget::acceptTextureDropOnMaterial(int matIndex, const QString &texId) |