Windows: Avoid accidentally copying QWindowsScreenManager

Pick-to: 6.2 6.3 6.4
Change-Id: I60b219e9a3ea62a96c369ee910eacf06d61f4f71
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Tor Arne Vestbø 2022-06-15 23:36:12 +02:00
parent 91fd8bdb11
commit 7d2488280e
3 changed files with 4 additions and 3 deletions

View File

@ -92,6 +92,7 @@ private:
class QWindowsScreenManager
{
Q_DISABLE_COPY_MOVE(QWindowsScreenManager)
public:
using WindowsScreenList = QList<QWindowsScreen *>;

View File

@ -571,7 +571,7 @@ void QWindowsTheme::refreshFonts()
if (!QGuiApplication::desktopSettingsAware())
return;
NONCLIENTMETRICS ncm;
auto screenManager = QWindowsContext::instance()->screenManager();
auto &screenManager = QWindowsContext::instance()->screenManager();
QWindowsContext::nonClientMetricsForScreen(&ncm, screenManager.screens().value(0));
qCDebug(lcQpaWindows) << __FUNCTION__ << ncm;
const QFont menuFont = QWindowsFontDatabase::LOGFONT_to_QFont(ncm.lfMenuFont);

View File

@ -1059,7 +1059,7 @@ QMargins QWindowsGeometryHint::frame(const QWindow *w, HWND hwnd, DWORD style, D
return {};
if (QWindowsScreenManager::isSingleScreen())
return frameOnPrimaryScreen(w, style, exStyle);
auto screenManager = QWindowsContext::instance()->screenManager();
auto &screenManager = QWindowsContext::instance()->screenManager();
auto screen = screenManager.screenForHwnd(hwnd);
if (!screen)
screen = screenManager.screens().value(0);
@ -1086,7 +1086,7 @@ QMargins QWindowsGeometryHint::frame(const QWindow *w, const QRect &geometry,
return frameOnPrimaryScreen(w, style, exStyle);
}
qreal dpi = 96;
auto screenManager = QWindowsContext::instance()->screenManager();
auto &screenManager = QWindowsContext::instance()->screenManager();
auto screen = screenManager.screenAtDp(geometry.center());
if (!screen)
screen = screenManager.screens().value(0);