Qt5, Qt6: fixed setting scale factor on normal monitors without scaling. issue #41330

This commit is contained in:
Željan Rikalo 2025-01-12 18:13:11 +01:00
parent 395b854b3c
commit d50b1f2b9b
2 changed files with 12 additions and 6 deletions

View File

@ -874,9 +874,12 @@ var
begin
if IsValidDC(DC) and (QtDC.vImage <> nil) and (QtDC.vImage.Handle <> nil) then
begin
QPainter_end(QtDC.Widget);
QImage_setDevicePixelRatio(QtDC.vImage.Handle, AScaleFactor);
QPainter_begin(QtDC.Widget, QtDC.vImage.Handle);
if not SameValue(AScaleFactor, QImage_devicePixelRatio(QtDC.vImage.Handle)) then
begin
QPainter_end(QtDC.Widget);
QImage_setDevicePixelRatio(QtDC.vImage.Handle, AScaleFactor);
QPainter_begin(QtDC.Widget, QtDC.vImage.Handle);
end;
end;
end;

View File

@ -893,9 +893,12 @@ var
begin
if IsValidDC(DC) and (QtDC.vImage <> nil) and (QtDC.vImage.Handle <> nil) then
begin
QPainter_end(QtDC.Widget);
QImage_setDevicePixelRatio(QtDC.vImage.Handle, AScaleFactor);
QPainter_begin(QtDC.Widget, QtDC.vImage.Handle);
if not SameValue(AScaleFactor, QImage_devicePixelRatio(QtDC.vImage.Handle)) then
begin
QPainter_end(QtDC.Widget);
QImage_setDevicePixelRatio(QtDC.vImage.Handle, AScaleFactor);
QPainter_begin(QtDC.Widget, QtDC.vImage.Handle);
end;
end;
end;