summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2018-12-10 08:29:47 +0200
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2018-12-10 07:39:29 +0000
commit69c3a54687eed3bca968aaba4efd87334df7304f (patch)
tree30924363394da5a33dbef3bbaf352d8f67529212 /src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
parent659b2996c9ab6b3b0b556151b89bf04ea911cca1 (diff)
Close active chooser dialog when it goes out of context
A chooser is considered out of context when the property the chooser was opened for no longer has visible control for it. This change should ensure that user can never interact with invalid properties via the chooser dialogs. Task-number: QT3DS-2836 Change-Id: I6fca811cfccda0b0b4fbc0feb17935c3949f4f9f Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp')
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
index 10d79c02..e427c2de 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
@@ -362,6 +362,7 @@ void InspectorControlView::updateInspectable(CInspectableBase *inInspectable)
void InspectorControlView::setInspectable(CInspectableBase *inInspectable)
{
if (m_inspectableBase != inInspectable) {
+ m_activeBrowser.clear();
m_inspectableBase = inInspectable;
m_inspectorControlModel->setInspectable(inInspectable);
@@ -469,6 +470,7 @@ QObject *InspectorControlView::showImageChooser(int handle, int instance, const
m_imageChooserView->setInstance(instance);
CDialogs::showWidgetBrowser(this, m_imageChooserView, point);
+ m_activeBrowser.setData(m_imageChooserView, handle, instance);
return m_imageChooserView;
}
@@ -487,6 +489,7 @@ QObject *InspectorControlView::showFilesChooser(int handle, int instance, const
m_fileChooserView->setInstance(instance);
CDialogs::showWidgetBrowser(this, m_fileChooserView, point);
+ m_activeBrowser.setData(m_fileChooserView, handle, instance);
return m_fileChooserView;
}
@@ -510,6 +513,7 @@ QObject *InspectorControlView::showMeshChooser(int handle, int instance, const Q
m_meshChooserView->setInstance(instance);
CDialogs::showWidgetBrowser(this, m_meshChooserView, point);
+ m_activeBrowser.setData(m_meshChooserView, handle, instance);
return m_meshChooserView;
}
@@ -529,6 +533,7 @@ QObject *InspectorControlView::showTextureChooser(int handle, int instance, cons
m_textureChooserView->setInstance(instance);
CDialogs::showWidgetBrowser(this, m_textureChooserView, point);
+ m_activeBrowser.setData(m_textureChooserView, handle, instance);
return m_textureChooserView;
}
@@ -570,6 +575,7 @@ QObject *InspectorControlView::showObjectReference(int handle, int instance, con
}
CDialogs::showWidgetBrowser(this, m_objectReferenceView, point);
+ m_activeBrowser.setData(m_objectReferenceView, handle, instance);
connect(m_objectReferenceView, &ObjectBrowserView::selectionChanged,
this, [this, doc, handle, instance] {
@@ -606,6 +612,7 @@ QObject *InspectorControlView::showMaterialReference(int handle, int instance, c
CDialogs::showWidgetBrowser(this, m_matRefListWidget, point,
CDialogs::WidgetBrowserAlign::ComboBox,
QSize(CStudioPreferences::valueWidth(), popupHeight));
+ m_activeBrowser.setData(m_matRefListWidget, handle, instance);
connect(m_matRefListWidget, &QListWidget::itemClicked, this,
[doc, propertySystem, instance, handle](QListWidgetItem *item) {
@@ -660,6 +667,7 @@ void InspectorControlView::showDataInputChooser(int handle, int instance, const
handle, instance);
CDialogs::showWidgetBrowser(this, m_dataInputChooserView, point,
CDialogs::WidgetBrowserAlign::ToolButton);
+ m_activeBrowser.setData(m_dataInputChooserView, handle, instance);
}
QColor InspectorControlView::showColorDialog(const QColor &color)
@@ -702,6 +710,12 @@ void InspectorControlView::OnEndDataModelNotifications()
if (inspectable && !inspectable->IsValid())
OnSelectionSet(Q3DStudio::SSelectedValue());
m_inspectorControlModel->refresh();
+
+ // Check if the instance/handle pair still has an active UI control. If not, close browser.
+ if (m_activeBrowser.isActive() && !m_inspectorControlModel->hasInstanceProperty(
+ m_activeBrowser.m_instance, m_activeBrowser.m_handle)) {
+ m_activeBrowser.clear();
+ }
}
void InspectorControlView::OnImmediateRefreshInstanceSingle(qt3dsdm::Qt3DSDMInstanceHandle inInstance)