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>
This commit is contained in:
@@ -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"));
|
||||
|
@@ -311,6 +311,8 @@ void AssetsLibraryWidget::handleExtFilesDrop(const QList<QUrl> &simpleFilePaths,
|
||||
|
||||
if (!complexFilePathStrings.empty())
|
||||
addResources(complexFilePathStrings);
|
||||
|
||||
emit endDrag();
|
||||
}
|
||||
|
||||
QSet<QString> AssetsLibraryWidget::supportedAssetSuffixes(bool complex)
|
||||
|
@@ -108,6 +108,7 @@ signals:
|
||||
void hasMaterialLibraryUpdateRequested();
|
||||
void hasMaterialLibraryChanged();
|
||||
void isDraggingChanged();
|
||||
void endDrag();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user