summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorAleksei Nikiforov <darktemplar@basealt.ru>2019-02-21 10:24:39 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-02-22 18:09:08 +0100
commit8777fc78ce7913b774d1c6ef660c7668c6c7b526 (patch)
treec1d18ff5bef05a597737224c7306c059a168d1f0 /vcl
parente79e8117dcc7475d8d90afeaaac9eb7050ff244e (diff)
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@CIB.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qt5/Qt5Frame.cxx21
1 files changed, 15 insertions, 6 deletions
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());
}
}