From 6747e666b9cc9c47b26b3c2971e56b83ac29c7c3 Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Thu, 24 Nov 2022 23:42:26 +0200 Subject: [PATCH] QmlDesigner: Open TextureEditor by double-clicking a texture Change-Id: I58645f31f244cf4e5909b35f1cae224a55f4e9a4 Reviewed-by: Reviewed-by: Miikka Heikkinen Reviewed-by: Samuel Ghinet --- .../materialBrowserQmlSource/TextureItem.qml | 2 ++ .../materialbrowsertexturesmodel.cpp | 18 +++++++++++------- .../materialbrowsertexturesmodel.h | 3 ++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/share/qtcreator/qmldesigner/materialBrowserQmlSource/TextureItem.qml b/share/qtcreator/qmldesigner/materialBrowserQmlSource/TextureItem.qml index b0861aa882e..a666354b832 100644 --- a/share/qtcreator/qmldesigner/materialBrowserQmlSource/TextureItem.qml +++ b/share/qtcreator/qmldesigner/materialBrowserQmlSource/TextureItem.qml @@ -34,6 +34,8 @@ Rectangle { else if (mouse.button === Qt.RightButton) root.showContextMenu() } + + onDoubleClicked: materialBrowserTexturesModel.openTextureEditor(); } Image { diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.cpp index b7851157ee4..781b43622fd 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.cpp @@ -3,13 +3,12 @@ #include "materialbrowsertexturesmodel.h" -#include -#include -#include -#include -#include -#include -#include "utils/qtcassert.h" +#include "designmodewidget.h" +#include "qmldesignerplugin.h" +#include "qmlobjectnode.h" +#include "variantproperty.h" + +#include namespace QmlDesigner { @@ -264,4 +263,9 @@ void MaterialBrowserTexturesModel::applyToSelectedModel(qint64 internalId) } } +void MaterialBrowserTexturesModel::openTextureEditor() +{ + QmlDesignerPlugin::instance()->mainWidget()->showDockWidget("TextureEditor", true); +} + } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.h b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.h index 3f5a59ea54f..34e4fb23647 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.h +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.h @@ -3,7 +3,7 @@ #pragma once -#include +#include "modelnode.h" #include #include @@ -49,6 +49,7 @@ public: Q_INVOKABLE void deleteTexture(int idx); Q_INVOKABLE void applyToSelectedMaterial(qint64 internalId); Q_INVOKABLE void applyToSelectedModel(qint64 internalId); + Q_INVOKABLE void openTextureEditor(); signals: void isEmptyChanged();