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

@ -873,11 +873,14 @@ var
QtDc: TQtDeviceContext absolute DC;
begin
if IsValidDC(DC) and (QtDC.vImage <> nil) and (QtDC.vImage.Handle <> nil) then
begin
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;
procedure TQtWidgetSet.SetEventHandlerFlags(AHandler: PEventHandler;

View File

@ -892,11 +892,14 @@ var
QtDc: TQtDeviceContext absolute DC;
begin
if IsValidDC(DC) and (QtDC.vImage <> nil) and (QtDC.vImage.Handle <> nil) then
begin
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;
procedure TQtWidgetSet.SetEventHandlerFlags(AHandler: PEventHandler;