diff options
-rw-r--r-- | vcl/inc/qt5/QtFrame.hxx | 6 | ||||
-rw-r--r-- | vcl/inc/qt5/QtWidget.hxx | 1 | ||||
-rw-r--r-- | vcl/qt5/QtFrame.cxx | 19 | ||||
-rw-r--r-- | vcl/qt5/QtWidget.cxx | 6 |
4 files changed, 25 insertions, 7 deletions
diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx index c6edaa58304d..a873cec76ad6 100644 --- a/vcl/inc/qt5/QtFrame.hxx +++ b/vcl/inc/qt5/QtFrame.hxx @@ -25,6 +25,7 @@ #include <vclpluginapi.h> #include "QtTools.hxx" +#include "QtWidget.hxx" #include <headless/svpgdi.hxx> #include <vcl/svapp.hxx> @@ -70,7 +71,7 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public SalFrame friend class QtWidget; - QWidget* m_pQWidget; + QtWidget* m_pQWidget; QtMainWindow* m_pTopLevel; const bool m_bUseCairo; @@ -133,6 +134,9 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public SalFrame void fixICCCMwindowGroup(); +private Q_SLOTS: + void screenChanged(QScreen*); + public: QtFrame(QtFrame* pParent, SalFrameStyleFlags nSalFrameStyle, bool bUseCairo); virtual ~QtFrame() override; diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx index e2a22d3c9f18..575cef11014f 100644 --- a/vcl/inc/qt5/QtWidget.hxx +++ b/vcl/inc/qt5/QtWidget.hxx @@ -85,6 +85,7 @@ public: QtFrame& frame() const { return m_rFrame; } void endExtTextInput(); + void fakeResize(); static bool handleEvent(QtFrame&, const QWidget&, QEvent*); // key events might be propagated further down => call base on false diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index b8f649e64b78..91361311d60e 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -30,7 +30,6 @@ #include <QtSystem.hxx> #include <QtTools.hxx> #include <QtTransferable.hxx> -#include <QtWidget.hxx> #include <QtCore/QMimeData> #include <QtCore/QPoint> @@ -176,10 +175,12 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) else m_pQWidget = new QtWidget(*this, aWinFlags); + QWindow* pChildWindow = windowHandle(); + connect(pChildWindow, &QWindow::screenChanged, this, &QtFrame::screenChanged); + if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG)) { QWindow* pParentWindow = pParent->windowHandle(); - QWindow* pChildWindow = windowHandle(); if (pParentWindow && pChildWindow && (pParentWindow != pChildWindow)) pChildWindow->setTransientParent(pParentWindow); } @@ -191,6 +192,8 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) fixICCCMwindowGroup(); } +void QtFrame::screenChanged(QScreen*) { m_pQWidget->fakeResize(); } + void QtFrame::FillSystemEnvData(SystemEnvData& rData, sal_IntPtr pWindow, QWidget* pWidget) { if (QGuiApplication::platformName() == "wayland") @@ -343,7 +346,12 @@ bool QtFrame::PostEvent(std::unique_ptr<ImplSVEvent> pData) return true; } -QWidget* QtFrame::asChild() const { return m_pTopLevel ? m_pTopLevel : m_pQWidget; } +QWidget* QtFrame::asChild() const +{ + if (m_pTopLevel) + return m_pTopLevel; + return m_pQWidget; +} qreal QtFrame::devicePixelRatioF() const { return asChild()->devicePixelRatioF(); } @@ -868,9 +876,8 @@ void QtFrame::SetInputContext(SalInputContext* pContext) void QtFrame::EndExtTextInput(EndExtTextInputFlags /*nFlags*/) { - QtWidget* pQtWidget = static_cast<QtWidget*>(m_pQWidget); - if (pQtWidget) - pQtWidget->endExtTextInput(); + if (m_pQWidget) + m_pQWidget->endExtTextInput(); } OUString QtFrame::GetKeyName(sal_uInt16 nKeyCode) diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index cd47492808cc..612682ae987f 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -134,6 +134,12 @@ void QtWidget::resizeEvent(QResizeEvent* pEvent) m_rFrame.CallCallback(SalEvent::Resize, nullptr); } +void QtWidget::fakeResize() +{ + QResizeEvent aEvent(size(), QSize()); + resizeEvent(&aEvent); +} + void QtWidget::fillSalAbstractMouseEvent(const QtFrame& rFrame, const QInputEvent* pQEvent, const QPoint& rPos, Qt::MouseButtons eButtons, int nWidth, SalAbstractMouseEvent& aSalEvent) |