[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - vcl/qt5
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Feb 23 09:09:44 UTC 2019
vcl/qt5/Qt5Frame.cxx | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
New commits:
commit f184af314ec43fbac5bb22cd3ebc09ccdf865a7c
Author: Aleksei Nikiforov <darktemplar at basealt.ru>
AuthorDate: Thu Feb 21 10:24:39 2019 +0300
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sat Feb 23 10:09:23 2019 +0100
tdf#122256 KDE5: Make menubar work for windows with parents
Change-Id: I325faec8594e1c5b8b2c34a135f1604244e4826c
Reviewed-on: https://gerrit.libreoffice.org/68140
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
(cherry picked from commit 8777fc78ce7913b774d1c6ef660c7668c6c7b526)
Reviewed-on: https://gerrit.libreoffice.org/68221
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 55e0eea76ff7..6d96f7926c0f 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -108,9 +108,16 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo)
aWinFlags |= Qt::Window;
}
- if (!pParent && (aWinFlags == Qt::Window))
+ if (aWinFlags == Qt::Window)
{
- m_pTopLevel = new Qt5MainWindow(*this, nullptr, aWinFlags);
+ QWidget* pParentWidget = nullptr;
+ if (m_pParent)
+ {
+ pParentWidget
+ = (m_pParent->m_pTopLevel) ? m_pParent->m_pTopLevel : m_pParent->m_pQWidget;
+ }
+
+ m_pTopLevel = new Qt5MainWindow(*this, pParentWidget, aWinFlags);
m_pQWidget = new Qt5Widget(*this, aWinFlags);
m_pTopLevel->setCentralWidget(m_pQWidget);
}
@@ -124,8 +131,9 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo)
if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG))
{
QWindow* pParentWindow = pParent->GetQWidget()->window()->windowHandle();
- QWindow* pChildWindow = m_pQWidget->window()->windowHandle();
- if (pParentWindow != pChildWindow)
+ QWindow* pChildWindow = (m_pTopLevel ? m_pTopLevel->window()->windowHandle()
+ : m_pQWidget->window()->windowHandle());
+ if (pParentWindow && pChildWindow && (pParentWindow != pChildWindow))
pChildWindow->setTransientParent(pParentWindow);
}
@@ -366,8 +374,9 @@ void Qt5Frame::Center()
if (m_pParent)
{
QWidget* pWindow = m_pParent->GetQWidget()->window();
- m_pQWidget->move(pWindow->frameGeometry().topLeft() + pWindow->rect().center()
- - m_pQWidget->rect().center());
+ QWidget* const pWidget = (m_pTopLevel) ? m_pTopLevel : m_pQWidget;
+ pWidget->move(pWindow->frameGeometry().topLeft() + pWindow->rect().center()
+ - pWidget->rect().center());
}
}
More information about the Libreoffice-commits
mailing list