forked from qt-creator/qt-creator
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>
(cherry picked from commit d3d621a7b3
)
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Tim Jenssen
parent
878a5db73e
commit
f8911f56fc
@@ -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()
|
m_widget->setHasMaterialLibrary(model() && materialLibraryNode().isValid()
|
||||||
&& model()->hasImport("QtQuick3D"));
|
&& model()->hasImport("QtQuick3D"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(m_widget, &AssetsLibraryWidget::endDrag, this, [&]() {
|
||||||
|
if (model())
|
||||||
|
model()->endDrag();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return createWidgetInfo(m_widget.data(), "Assets", WidgetInfo::LeftPane, 0, tr("Assets"));
|
return createWidgetInfo(m_widget.data(), "Assets", WidgetInfo::LeftPane, 0, tr("Assets"));
|
||||||
|
@@ -311,6 +311,8 @@ void AssetsLibraryWidget::handleExtFilesDrop(const QList<QUrl> &simpleFilePaths,
|
|||||||
|
|
||||||
if (!complexFilePathStrings.empty())
|
if (!complexFilePathStrings.empty())
|
||||||
addResources(complexFilePathStrings);
|
addResources(complexFilePathStrings);
|
||||||
|
|
||||||
|
emit endDrag();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<QString> AssetsLibraryWidget::supportedAssetSuffixes(bool complex)
|
QSet<QString> AssetsLibraryWidget::supportedAssetSuffixes(bool complex)
|
||||||
|
@@ -108,6 +108,7 @@ signals:
|
|||||||
void hasMaterialLibraryUpdateRequested();
|
void hasMaterialLibraryUpdateRequested();
|
||||||
void hasMaterialLibraryChanged();
|
void hasMaterialLibraryChanged();
|
||||||
void isDraggingChanged();
|
void isDraggingChanged();
|
||||||
|
void endDrag();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||||
|
@@ -267,11 +267,15 @@ void MaterialBrowserWidget::startDragTexture(int index, const QPointF &mousePos)
|
|||||||
void MaterialBrowserWidget::acceptBundleMaterialDrop()
|
void MaterialBrowserWidget::acceptBundleMaterialDrop()
|
||||||
{
|
{
|
||||||
m_materialBrowserView->emitCustomNotification("drop_bundle_material", {}, {}); // To ContentLibraryView
|
m_materialBrowserView->emitCustomNotification("drop_bundle_material", {}, {}); // To ContentLibraryView
|
||||||
|
if (m_materialBrowserView->model())
|
||||||
|
m_materialBrowserView->model()->endDrag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaterialBrowserWidget::acceptBundleTextureDrop()
|
void MaterialBrowserWidget::acceptBundleTextureDrop()
|
||||||
{
|
{
|
||||||
m_materialBrowserView->emitCustomNotification("drop_bundle_texture", {}, {}); // To ContentLibraryView
|
m_materialBrowserView->emitCustomNotification("drop_bundle_texture", {}, {}); // To ContentLibraryView
|
||||||
|
if (m_materialBrowserView->model())
|
||||||
|
m_materialBrowserView->model()->endDrag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaterialBrowserWidget::acceptTextureDropOnMaterial(int matIndex, const QString &texId)
|
void MaterialBrowserWidget::acceptTextureDropOnMaterial(int matIndex, const QString &texId)
|
||||||
|
Reference in New Issue
Block a user