diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2018-12-10 08:29:47 +0200 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2018-12-10 07:39:29 +0000 |
commit | 69c3a54687eed3bca968aaba4efd87334df7304f (patch) | |
tree | 30924363394da5a33dbef3bbaf352d8f67529212 /src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h | |
parent | 659b2996c9ab6b3b0b556151b89bf04ea911cca1 (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.h')
-rw-r--r-- | src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h index a5661d74..400a26b4 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h @@ -144,6 +144,35 @@ private: QSize m_preferredSize; QColor m_currentColor; + + class ActiveBrowserData + { + public: + void setData(QWidget *browser, int handle, int instance) + { + m_activeBrowser = browser; + m_handle = handle; + m_instance = instance; + } + void clear() + { + if (isActive()) + m_activeBrowser->close(); + m_activeBrowser.clear(); + m_handle = -1; + m_instance = -1; + } + bool isActive() const + { + return !m_activeBrowser.isNull() && m_activeBrowser->isVisible(); + } + + QPointer<QWidget> m_activeBrowser = nullptr; + int m_handle = -1; + int m_instance = -1; + }; + + ActiveBrowserData m_activeBrowser; }; #endif // INSPECTORCONTROLVIEW_H |