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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Feb 22 17:09:41 UTC 2019


 vcl/qt5/Qt5Frame.cxx |   21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 8777fc78ce7913b774d1c6ef660c7668c6c7b526
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: Fri Feb 22 18:09:08 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>

diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 26db19ea62c7..615e2753f598 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -111,9 +111,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);
     }
@@ -127,8 +134,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);
     }
 
@@ -377,8 +385,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