Kaydet (Commit) 8777fc78 authored tarafından Aleksei Nikiforov's avatar Aleksei Nikiforov Kaydeden (comit) Thorsten Behrens

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: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst e79e8117
...@@ -111,9 +111,16 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) ...@@ -111,9 +111,16 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo)
aWinFlags |= Qt::Window; 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_pQWidget = new Qt5Widget(*this, aWinFlags);
m_pTopLevel->setCentralWidget(m_pQWidget); m_pTopLevel->setCentralWidget(m_pQWidget);
} }
...@@ -127,8 +134,9 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) ...@@ -127,8 +134,9 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo)
if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG)) if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG))
{ {
QWindow* pParentWindow = pParent->GetQWidget()->window()->windowHandle(); QWindow* pParentWindow = pParent->GetQWidget()->window()->windowHandle();
QWindow* pChildWindow = m_pQWidget->window()->windowHandle(); QWindow* pChildWindow = (m_pTopLevel ? m_pTopLevel->window()->windowHandle()
if (pParentWindow != pChildWindow) : m_pQWidget->window()->windowHandle());
if (pParentWindow && pChildWindow && (pParentWindow != pChildWindow))
pChildWindow->setTransientParent(pParentWindow); pChildWindow->setTransientParent(pParentWindow);
} }
...@@ -377,8 +385,9 @@ void Qt5Frame::Center() ...@@ -377,8 +385,9 @@ void Qt5Frame::Center()
if (m_pParent) if (m_pParent)
{ {
QWidget* pWindow = m_pParent->GetQWidget()->window(); QWidget* pWindow = m_pParent->GetQWidget()->window();
m_pQWidget->move(pWindow->frameGeometry().topLeft() + pWindow->rect().center() QWidget* const pWidget = (m_pTopLevel) ? m_pTopLevel : m_pQWidget;
- m_pQWidget->rect().center()); pWidget->move(pWindow->frameGeometry().topLeft() + pWindow->rect().center()
- pWidget->rect().center());
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment