[Libreoffice-commits] core.git: vcl/inc vcl/qt5

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Feb 11 13:13:41 UTC 2019


 vcl/inc/qt5/Qt5Frame.hxx |    1 +
 vcl/qt5/Qt5Frame.cxx     |   36 ++++++++++++++++++++++++++----------
 2 files changed, 27 insertions(+), 10 deletions(-)

New commits:
commit 9191b59ac13d59a50f88e74604f02eb97e969e89
Author:     Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Mon Feb 11 11:22:30 2019 +0100
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Mon Feb 11 14:13:17 2019 +0100

    tdf#119853: Set window state only, don't actually show the window
    
    showMaximized, showNormal etc. makes the windows visible, but it is
    not always desirable (e.g. documents opened with 'hidden' flag on)
    
    Change-Id: I15364c816c35865dbc2d74f1d1a46817b1277f43
    Reviewed-on: https://gerrit.libreoffice.org/67679
    Tested-by: Jenkins
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 669833f0ffd1..723f9fd7a175 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -101,6 +101,7 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame
     QScreen* screen() const;
     bool isMinimized() const;
     bool isMaximized() const;
+    void SetWindowStateImpl(Qt::WindowStates eState);
 
     void TriggerPaintEvent();
     void TriggerPaintEvent(QRect aRect);
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 55e0eea76ff7..512c15a8545c 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -280,6 +280,14 @@ bool Qt5Frame::isMaximized() const
         return m_pQWidget->isMaximized();
 }
 
+void Qt5Frame::SetWindowStateImpl(Qt::WindowStates eState)
+{
+    if (m_pTopLevel)
+        m_pTopLevel->setWindowState(eState);
+    else
+        m_pQWidget->setWindowState(eState);
+}
+
 void Qt5Frame::SetTitle(const OUString& rTitle)
 {
     m_pQWidget->window()->setWindowTitle(toQString(rTitle));
@@ -497,7 +505,19 @@ void Qt5Frame::SetWindowState(const SalFrameState* pState)
 
     if ((pState->mnMask & WindowStateMask::State) && (pState->mnState & WindowStateState::Maximized)
         && !isMaximized() && (pState->mnMask & nMaxGeometryMask) == nMaxGeometryMask)
-        m_pQWidget->showMaximized();
+    {
+        if (m_pTopLevel)
+        {
+            m_pTopLevel->resize(pState->mnWidth, pState->mnHeight);
+            m_pTopLevel->move(pState->mnX, pState->mnY);
+        }
+        else
+        {
+            m_pQWidget->resize(pState->mnWidth, pState->mnHeight);
+            m_pQWidget->move(pState->mnX, pState->mnY);
+        }
+        SetWindowStateImpl(Qt::WindowMaximized);
+    }
     else if (pState->mnMask
              & (WindowStateMask::X | WindowStateMask::Y | WindowStateMask::Width
                 | WindowStateMask::Height))
@@ -525,16 +545,12 @@ void Qt5Frame::SetWindowState(const SalFrameState* pState)
     }
     else if (pState->mnMask & WindowStateMask::State && !isChild())
     {
-        if (pState->mnState & WindowStateState::Maximized && m_pTopLevel)
-        {
-            m_pTopLevel->showMaximized();
-            return;
-        }
-
-        if ((pState->mnState & WindowStateState::Minimized) && isWindow())
-            m_pQWidget->showMinimized();
+        if (pState->mnState & WindowStateState::Maximized)
+            SetWindowStateImpl(Qt::WindowMaximized);
+        else if ((pState->mnState & WindowStateState::Minimized))
+            SetWindowStateImpl(Qt::WindowMinimized);
         else
-            m_pQWidget->showNormal();
+            SetWindowStateImpl(Qt::WindowNoState);
     }
 }
 


More information about the Libreoffice-commits mailing list