QmlDesigner: Allow deleting materials using the delete action

Fixes: QDS-7012
Change-Id: I5eb03971d33a997fc1463ec4ee70eb33a730a897
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Mahmoud Badri
2022-08-04 12:40:06 +03:00
parent 01bb84b808
commit ec565eea99
12 changed files with 97 additions and 24 deletions

View File

@@ -32,6 +32,7 @@
#include <coreplugin/icore.h>
#include <nodeinstanceview.h>
#include <qmldesignerconstants.h>
#include <designmodecontext.h>
#include <QQuickItem>
@@ -53,7 +54,11 @@ bool MaterialBrowserView::hasWidget() const
WidgetInfo MaterialBrowserView::widgetInfo()
{
if (m_widget.isNull()) {
m_widget = new MaterialBrowserWidget;
m_widget = new MaterialBrowserWidget(this);
auto matEditorContext = new Internal::MaterialBrowserContext(m_widget.data());
Core::ICore::addContextObject(matEditorContext);
MaterialBrowserModel *matBrowserModel = m_widget->materialBrowserModel().data();
// custom notifications below are sent to the MaterialEditor
@@ -288,6 +293,8 @@ void MaterialBrowserView::customNotification(const AbstractView *view, const QSt
QTimer::singleShot(0, this, [this]() {
refreshModel(true);
});
} else if (identifier == "delete_selected_material") {
m_widget->materialBrowserModel()->deleteSelectedMaterial();
}
}