From 4c1940a28ccb7937ef020f68751a865ead4e66f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDeljan=20Rikalo?= Date: Thu, 12 Dec 2024 16:41:56 +0100 Subject: [PATCH] Qt5: fixed blurred text when drawing QImage and QPixmap and hidpi enabled for qt libs >= 5.14. issue #41276 --- lcl/interfaces/qt5/qtobject.inc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lcl/interfaces/qt5/qtobject.inc b/lcl/interfaces/qt5/qtobject.inc index 13b18bf181..41e247dd62 100644 --- a/lcl/interfaces/qt5/qtobject.inc +++ b/lcl/interfaces/qt5/qtobject.inc @@ -25,6 +25,11 @@ begin FLastWFPMousePos := Point(MaxInt, MaxInt); FLastWFPResult := 0; inherited Create; + + {$J+} + QtVersionInt(QtVersionMajor, QtVersionMinor, QtVersionMicro); + {$J-} + FIsLibraryInstance := QCoreApplication_instance() <> nil; if FIsLibraryInstance then App := QApplicationH(QCoreApplication_instance()) @@ -35,8 +40,13 @@ begin WStr := 'plugins'; QCoreApplication_addLibraryPath(@WStr); {$ENDIF} - // issue #39610 - // QCoreApplication_setAttribute(QtAA_DisableHighDpiScaling, True); + {$IF DEFINED(UNIX) AND NOT DEFINED(DARWIN)} + if (QtVersionMajor = 5) and (QtVersionMinor >= 14) then + begin + QCoreApplication_setAttribute(QtAA_EnableHighDpiScaling, False); // issue #39610, #41276 + QCoreApplication_setAttribute(QtAA_DisableHighDpiScaling, True); // issue #39610, #41276 + end; + {$ENDIF} App := QApplication_Create(@argc, argv); end; QCoreApplication_setAttribute(QtAA_DontCreateNativeWidgetSiblings, True); @@ -46,9 +56,6 @@ begin {$IFDEF QtUseNativeEventLoop} FMainTimerID := -1; {$ENDIF} - {$J+} - QtVersionInt(QtVersionMajor, QtVersionMinor, QtVersionMicro); - {$J-} FCachedMenuBarHeight := -1; FAppEvenFilterHook := nil; {$IFDEF QTUSEFOCUSCHANGEDHOOK}