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