diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-06-27 10:41:03 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-07-03 14:10:49 +0200 |
commit | c4a06289ca549290bfd2ba9e16236e430b4c53fe (patch) | |
tree | 78179d69a147856793e6c9515e250e2a8b2695f6 /vcl | |
parent | b1a5ce7d1db7b654ad49b8865ecdf482ef05e2b7 (diff) |
Implement native modality for modal dialogs
instead of hack with hiding the window and showing it again (otherwise
modality change has no effect and worse yet, weird things happen)
it would be much easier to use QDialog
Change-Id: Ie7029ca66380495c4aad246d02f4b96cb55eb01e
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/qt5/Qt5Frame.hxx | 1 | ||||
-rw-r--r-- | vcl/qt5/Qt5Frame.cxx | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx index 268441ea688a..96446c28a358 100644 --- a/vcl/inc/qt5/Qt5Frame.hxx +++ b/vcl/inc/qt5/Qt5Frame.hxx @@ -107,6 +107,7 @@ public: virtual void GetClientSize(long& rWidth, long& rHeight) override; virtual void GetWorkArea(tools::Rectangle& rRect) override; virtual SalFrame* GetParent() const override; + virtual void SetModal(bool bModal) override; virtual void SetWindowState(const SalFrameState* pState) override; virtual bool GetWindowState(SalFrameState* pState) override; virtual void ShowFullScreen(bool bFullScreen, sal_Int32 nDisplay) override; diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx index 9c5b8edbc5be..b47b64ab1cb8 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -345,6 +345,18 @@ void Qt5Frame::GetWorkArea(tools::Rectangle& rRect) SalFrame* Qt5Frame::GetParent() const { return m_pParent; } +void Qt5Frame::SetModal(bool bModal) +{ + if (m_pQWidget->isWindow()) + { + // modality change is only effective if the window is hidden + m_pQWidget->windowHandle()->hide(); + m_pQWidget->windowHandle()->setModality(bModal ? Qt::WindowModal : Qt::NonModal); + // and shown again + m_pQWidget->windowHandle()->show(); + } +} + void Qt5Frame::SetWindowState(const SalFrameState* pState) { if (!m_pQWidget->isWindow() || !pState || isChild(true, false)) |