From aa025b0f3b9c5d75a41db5fa03712da72e32b3e0 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Sun, 14 Dec 2025 11:26:21 +0800 Subject: [PATCH] Revert "chore: avoid use screenAt(QCursor::pos())" I actually forgot why I did this, I might thought this API is deprecated? Reverting this resolved the issue that window is not appeared at the screen that currently the cursor is at. This reverts commit 4375fe1c2d1a5714285b7370fde5fb2214c71f6a. --- app/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp index 8487c14..403eafa 100644 --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -222,7 +222,7 @@ void MainWindow::adjustWindowSizeBySceneRect() if (m_graphicsView->scaleFactor() < 1 || size().expandedTo(sceneSizeWithMargins) != size()) { // if it scaled down by the resize policy: - QSize screenSize = window()->screen()->availableSize(); + QSize screenSize = qApp->screenAt(QCursor::pos())->availableSize(); if (screenSize.expandedTo(sceneSize) == screenSize) { // we can show the picture by increase the window size. QSize finalSize = (screenSize.expandedTo(sceneSizeWithMargins) == screenSize) ? @@ -584,7 +584,7 @@ void MainWindow::centerWindow() Qt::LeftToRight, Qt::AlignCenter, this->size(), - window()->screen()->availableGeometry() + qApp->screenAt(QCursor::pos())->availableGeometry() ) ); }