diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-09-27 09:54:20 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-09-28 09:33:55 +0200 |
commit | 0218519537f6b77e06ae1e3020ed681b5a4f812c (patch) | |
tree | 97729e8c138b9938f198ab2c61a619a7f954da08 /vcl/qt5/QtFrame.cxx | |
parent | bce84c97257b986dfdfeaf69042278128d005a8c (diff) |
qt: Make screenNumber() a QtFrame method
Don't explicitly pass a QScreen, but use the
current one. Both callers set the screen
just before calling the method.
Change-Id: I57b3ffc4341cabc0370dda3c26d85f2f63ec9292
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174032
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/qt5/QtFrame.cxx')
-rw-r--r-- | vcl/qt5/QtFrame.cxx | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 218af25130e0..1c2e81938ecb 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -74,15 +74,6 @@ static void SvpDamageHandler(void* handle, sal_Int32 nExtentsX, sal_Int32 nExten pThis->Damage(nExtentsX, nExtentsY, nExtentsWidth, nExtentsHeight); } -namespace -{ -sal_Int32 screenNumber(QScreen* pScreen) -{ - const QList<QScreen*> screens = QApplication::screens(); - return screens.indexOf(pScreen); -} -} - QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) : m_pTopLevel(nullptr) , m_bUseCairo(bUseCairo) @@ -292,6 +283,13 @@ QWindow* QtFrame::windowHandle() const QScreen* QtFrame::screen() const { return asChild()->screen(); } +sal_Int32 QtFrame::screenNumber() const +{ + QScreen* pScreen = screen(); + const QList<QScreen*> screens = QApplication::screens(); + return screens.indexOf(pScreen); +} + bool QtFrame::GetUseDarkMode() const { #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) @@ -1308,7 +1306,7 @@ void QtFrame::SetScreenNumber(unsigned int nScreen) screenGeo = pScreen->availableVirtualGeometry(); pWindow->setScreen(pScreen); pWindow->setGeometry(screenGeo); - nScreen = screenNumber(pScreen); + nScreen = screenNumber(); } // setScreen by itself has no effect, explicitly move the widget to @@ -1320,7 +1318,7 @@ void QtFrame::SetScreenNumber(unsigned int nScreen) // index outta bounds, use primary screen QScreen* primaryScreen = QApplication::primaryScreen(); pWindow->setScreen(primaryScreen); - nScreen = static_cast<sal_uInt32>(screenNumber(primaryScreen)); + nScreen = static_cast<sal_uInt32>(screenNumber()); } maGeometry.setScreen(nScreen); |