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@cib.de>
(cherry picked from commit 9191b59ac13d59a50f88e74604f02eb97e969e89)
Reviewed-on: https://gerrit.libreoffice.org/69126
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index f3f8a38..4a1dc67 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 1ecf9cf..0f34199 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -293,6 +293,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));
@@ -519,7 +527,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))
@@ -547,16 +567,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);
}
}