QmlDesigner: Open TextureEditor by double-clicking a texture

Change-Id: I58645f31f244cf4e5909b35f1cae224a55f4e9a4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
This commit is contained in:
Mahmoud Badri
2022-11-24 23:42:26 +02:00
parent 45c7a6b8e6
commit 6747e666b9
3 changed files with 15 additions and 8 deletions

View File

@@ -34,6 +34,8 @@ Rectangle {
else if (mouse.button === Qt.RightButton) else if (mouse.button === Qt.RightButton)
root.showContextMenu() root.showContextMenu()
} }
onDoubleClicked: materialBrowserTexturesModel.openTextureEditor();
} }
Image { Image {

View File

@@ -3,13 +3,12 @@
#include "materialbrowsertexturesmodel.h" #include "materialbrowsertexturesmodel.h"
#include <bindingproperty.h> #include "designmodewidget.h"
#include <designmodewidget.h> #include "qmldesignerplugin.h"
#include <qmldesignerplugin.h> #include "qmlobjectnode.h"
#include <qmlobjectnode.h> #include "variantproperty.h"
#include <variantproperty.h>
#include <qmltimelinekeyframegroup.h> #include <utils/qtcassert.h>
#include "utils/qtcassert.h"
namespace QmlDesigner { namespace QmlDesigner {
@@ -264,4 +263,9 @@ void MaterialBrowserTexturesModel::applyToSelectedModel(qint64 internalId)
} }
} }
void MaterialBrowserTexturesModel::openTextureEditor()
{
QmlDesignerPlugin::instance()->mainWidget()->showDockWidget("TextureEditor", true);
}
} // namespace QmlDesigner } // namespace QmlDesigner

View File

@@ -3,7 +3,7 @@
#pragma once #pragma once
#include <modelnode.h> #include "modelnode.h"
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QObject> #include <QObject>
@@ -49,6 +49,7 @@ public:
Q_INVOKABLE void deleteTexture(int idx); Q_INVOKABLE void deleteTexture(int idx);
Q_INVOKABLE void applyToSelectedMaterial(qint64 internalId); Q_INVOKABLE void applyToSelectedMaterial(qint64 internalId);
Q_INVOKABLE void applyToSelectedModel(qint64 internalId); Q_INVOKABLE void applyToSelectedModel(qint64 internalId);
Q_INVOKABLE void openTextureEditor();
signals: signals:
void isEmptyChanged(); void isEmptyChanged();