diff options
author | Marco Bubke <marco.bubke@qt.io> | 2022-09-14 11:46:08 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2022-09-15 09:20:12 +0000 |
commit | 8aee8df4df75a22c6eb99c6c60a3f7654ab7c9ed (patch) | |
tree | f8bc579eca0aeaaaac63efad0fe29bf1773b8d8d /src/plugins/qmldesigner/components/edit3d/edit3dviewconfig.h | |
parent | 2bfc8173e5a4e26504c2e5a1a0d8cb6182f62eee (diff) | |
download | qt-creator-8aee8df4df75a22c6eb99c6c60a3f7654ab7c9ed.tar.gz |
QmlDesigner: Break dependency to View3DActionCommand
The node instance view and his commands should be not called directly
from other views. There are special classes QmlItem which can do it but
every change should go through the model.
Change-Id: I734e5538d7f6ecb07d736912f647c5eb92dc7631
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/plugins/qmldesigner/components/edit3d/edit3dviewconfig.h')
-rw-r--r-- | src/plugins/qmldesigner/components/edit3d/edit3dviewconfig.h | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dviewconfig.h b/src/plugins/qmldesigner/components/edit3d/edit3dviewconfig.h index 0a9b35bae9..0f2a670148 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dviewconfig.h +++ b/src/plugins/qmldesigner/components/edit3d/edit3dviewconfig.h @@ -3,8 +3,6 @@ #pragma once -#include <view3dactioncommand.h> - #include <nodeinstanceview.h> #include <qmldesignerplugin.h> @@ -30,17 +28,17 @@ public: }); } - static void set(View3DActionCommand::Type type, const QList<QColor> &colorConfig) + static void set(AbstractView *view, View3DActionType type, const QList<QColor> &colorConfig) { if (colorConfig.size() == 1) - set(type, colorConfig.at(0)); + set(view, type, colorConfig.at(0)); else - setVariant(type, QVariant::fromValue(colorConfig)); + setVariant(view, type, QVariant::fromValue(colorConfig)); } - static void set(View3DActionCommand::Type type, const QColor &color) + static void set(AbstractView *view, View3DActionType type, const QColor &color) { - setVariant(type, QVariant::fromValue(color)); + setVariant(view, type, QVariant::fromValue(color)); } static void save(const QByteArray &key, const QList<QColor> &colorConfig) @@ -60,11 +58,9 @@ public: static bool isValid(const QList<QColor> &colorConfig) { return !colorConfig.isEmpty(); } private: - static void setVariant(View3DActionCommand::Type type, const QVariant &colorConfig) + static void setVariant(AbstractView *view, View3DActionType type, const QVariant &colorConfig) { - auto view = QmlDesignerPlugin::instance()->viewManager().nodeInstanceView(); - View3DActionCommand cmd(type, colorConfig); - view->view3DAction(cmd); + view->emitView3DAction(type, colorConfig); } static void saveVariant(const QByteArray &key, const QVariant &colorConfig) |