forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user