QmlDesigner: Drag textures from content library to material browser

Fixes: QDS-8337
Change-Id: Iee42341a18e4acaa0d455aef276df36013ebf21e
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2022-11-22 17:09:31 +02:00
parent 34b236e7fb
commit fea463bb4a
7 changed files with 54 additions and 12 deletions

View File

@@ -8,6 +8,7 @@
#include "contentlibrarywidget.h"
#include "contentlibrarymaterial.h"
#include "contentlibrarymaterialsmodel.h"
#include "contentlibrarytexture.h"
#include "contentlibrarytexturesmodel.h"
#include "modelnodeoperations.h"
#include "nodelistproperty.h"
@@ -49,6 +50,10 @@ WidgetInfo ContentLibraryView::widgetInfo()
[&] (QmlDesigner::ContentLibraryMaterial *mat) {
m_draggedBundleMaterial = mat;
});
connect(m_widget, &ContentLibraryWidget::bundleTextureDragStarted, this,
[&] (QmlDesigner::ContentLibraryTexture *tex) {
m_draggedBundleTexture = tex;
});
connect(m_widget, &ContentLibraryWidget::addTextureRequested, this,
[&] (const QString texPath, ContentLibraryWidget::AddTextureMode mode) {
executeInTransaction("ContentLibraryView::widgetInfo", [&] {
@@ -237,6 +242,14 @@ void ContentLibraryView::customNotification(const AbstractView *view, const QStr
}
m_draggedBundleMaterial = nullptr;
} else if (identifier == "drop_bundle_texture") {
ModelNode matLib = materialLibraryNode();
if (!matLib.isValid())
return;
m_widget->addTexture(m_draggedBundleTexture);
m_draggedBundleTexture = nullptr;
}
}