summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Leinonen <tony.leinonen@qt.io>2020-09-17 15:10:09 +0300
committerTony Leinonen <tony.leinonen@qt.io>2020-09-18 08:04:52 +0300
commita863eff12691398afb21fef8b767985ec6a9dae1 (patch)
tree7b162f77ce99f39ef2b4ba8272d431eeda0da15d
parentc93a09cccc04c3797f8f4edc52c86809edca8994 (diff)
Fix color on action
ActionView was missing required functions to change the color. showColorDialog does not seem to require instance and handle which arent available in ActionView.cpp so call the function without them Task-number: QT3DS-4163 Change-Id: I135e75f22104e0c7addb203a52846e84c52db8de Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Action/ActionView.cpp12
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Action/ActionView.h6
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Action/HandlerGenericBaseColor.qml2
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/PaletteManager.cpp1
4 files changed, 20 insertions, 1 deletions
diff --git a/src/Authoring/Qt3DStudio/Palettes/Action/ActionView.cpp b/src/Authoring/Qt3DStudio/Palettes/Action/ActionView.cpp
index 5c3e02f9..56bd80dc 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Action/ActionView.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Action/ActionView.cpp
@@ -183,6 +183,11 @@ bool ActionView::event(QEvent *event)
return QQuickWidget::event(event);
}
+void ActionView::setControlView(InspectorControlView *controlView)
+{
+ m_inspectorControlView = controlView;
+}
+
void ActionView::setItem(const qt3dsdm::Qt3DSDMInstanceHandle &handle)
{
if (!m_activeBrowser.isNull() && m_activeBrowser->isVisible()) {
@@ -324,6 +329,11 @@ bool ActionView::isPropertyValueInvalid() const
return m_propertyValueInvalid;
}
+QColor ActionView::showColorDialog(const QColor &color, int instance, int handle)
+{
+ return ActionView::m_inspectorControlView->showColorDialog(color, instance, handle);
+}
+
void ActionView::setCurrentActionIndex(int index)
{
if (index == m_currentActionIndex)
@@ -1109,6 +1119,8 @@ void ActionView::initialize()
{
CStudioPreferences::setQmlContextProperties(rootContext());
rootContext()->setContextProperty(QStringLiteral("_parentView"), this);
+ rootContext()->setContextProperty(QStringLiteral("_inspectorModel"),
+ m_inspectorControlView->inspectorControlModel());
rootContext()->setContextProperty(QStringLiteral("_resDir"), StudioUtils::resourceImageUrl());
rootContext()->setContextProperty(QStringLiteral("_tabOrderHandler"), tabOrderHandler());
rootContext()->setContextProperty(QStringLiteral("_mouseHelper"), &m_mouseHelper);
diff --git a/src/Authoring/Qt3DStudio/Palettes/Action/ActionView.h b/src/Authoring/Qt3DStudio/Palettes/Action/ActionView.h
index c55ad143..6e826448 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Action/ActionView.h
+++ b/src/Authoring/Qt3DStudio/Palettes/Action/ActionView.h
@@ -48,6 +48,8 @@
#include "Qt3DSDMMetaDataTypes.h"
#include "TabOrderHandler.h"
#include "MouseHelper.h"
+#include "InspectorControlView.h"
+#include "InspectorControlModel.h"
class ActionModel;
class CClientDataModelBridge;
@@ -103,6 +105,7 @@ public:
QSize sizeHint() const override;
void setItem(const qt3dsdm::Qt3DSDMInstanceHandle &handle);
+ void setControlView(InspectorControlView *controlView);
QString itemIcon() const;
QString itemText() const;
QColor itemColor() const;
@@ -116,6 +119,8 @@ public:
PropertyInfo property() const;
bool isPropertyValueInvalid() const;
+
+ Q_INVOKABLE QColor showColorDialog(const QColor &color, int instance = 0, int handle = 0);
Q_INVOKABLE void setCurrentActionIndex(int index);
Q_INVOKABLE void setCurrentPropertyIndex(int handle, int index);
Q_INVOKABLE void addAction();
@@ -227,6 +232,7 @@ private:
bool m_propertyValueInvalid = true;
QColor m_currentColor;
QPointer<QWidget> m_activeBrowser = nullptr;
+ QPointer<InspectorControlView> m_inspectorControlView;
};
#endif // ACTIONVIEW_H
diff --git a/src/Authoring/Qt3DStudio/Palettes/Action/HandlerGenericBaseColor.qml b/src/Authoring/Qt3DStudio/Palettes/Action/HandlerGenericBaseColor.qml
index 8c184409..5b77dbdf 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Action/HandlerGenericBaseColor.qml
+++ b/src/Authoring/Qt3DStudio/Palettes/Action/HandlerGenericBaseColor.qml
@@ -69,7 +69,7 @@ RowLayout {
onClicked: {
root.listenToColorChanges = true;
_inspectorModel.suspendMaterialRename(true);
- root.selectedColor = _parentView.showColorDialog(rect.color, instance, handle);
+ root.selectedColor = _parentView.showColorDialog(rect.color);
root.listenToColorChanges = false;
_inspectorModel.suspendMaterialRename(false);
root.colorSelected();
diff --git a/src/Authoring/Qt3DStudio/Palettes/PaletteManager.cpp b/src/Authoring/Qt3DStudio/Palettes/PaletteManager.cpp
index 3f1a8c52..e30512e9 100644
--- a/src/Authoring/Qt3DStudio/Palettes/PaletteManager.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/PaletteManager.cpp
@@ -158,6 +158,7 @@ CPaletteManager::CPaletteManager(CMainFrame *inMainFrame, QObject *parent)
QSize(defaultRightDockWidth, inMainFrame->height() - defaultProjectHeight),
m_inspectorDock);
inspectorView->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ actionView->setControlView(inspectorView);
m_inspectorDock->setWidget(inspectorView);
inMainFrame->addDockWidget(Qt::RightDockWidgetArea, m_inspectorDock);
inMainFrame->tabifyDockWidget(m_inspectorDock, m_actionDock);