[Libreoffice-commits] core.git: Branch 'feature/qt5+kde5' - vcl/inc vcl/qt5
Katarina Behrens
Katarina.Behrens at cib.de
Wed Jun 27 08:47:55 UTC 2018
vcl/inc/qt5/Qt5Frame.hxx | 1 +
vcl/qt5/Qt5Frame.cxx | 12 ++++++++++++
2 files changed, 13 insertions(+)
New commits:
commit 588a4b353d712cadc88830c994156a4b318a9f2d
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed Jun 27 10:41:03 2018 +0200
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
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))
More information about the Libreoffice-commits
mailing list