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 begin
if IsValidDC(DC) and (QtDC.vImage <> nil) and (QtDC.vImage.Handle <> nil) then if IsValidDC(DC) and (QtDC.vImage <> nil) and (QtDC.vImage.Handle <> nil) then
begin begin
QPainter_end(QtDC.Widget); if not SameValue(AScaleFactor, QImage_devicePixelRatio(QtDC.vImage.Handle)) then
QImage_setDevicePixelRatio(QtDC.vImage.Handle, AScaleFactor); begin
QPainter_begin(QtDC.Widget, QtDC.vImage.Handle); QPainter_end(QtDC.Widget);
QImage_setDevicePixelRatio(QtDC.vImage.Handle, AScaleFactor);
QPainter_begin(QtDC.Widget, QtDC.vImage.Handle);
end;
end; end;
end; end;

View File

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