mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 22:41:42 +02:00
Qt5, Qt6: fixed setting scale factor on normal monitors without scaling. issue #41330
This commit is contained in:
parent
395b854b3c
commit
d50b1f2b9b
@ -873,12 +873,15 @@ var
|
|||||||
QtDc: TQtDeviceContext absolute DC;
|
QtDc: TQtDeviceContext absolute DC;
|
||||||
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
|
||||||
|
if not SameValue(AScaleFactor, QImage_devicePixelRatio(QtDC.vImage.Handle)) then
|
||||||
begin
|
begin
|
||||||
QPainter_end(QtDC.Widget);
|
QPainter_end(QtDC.Widget);
|
||||||
QImage_setDevicePixelRatio(QtDC.vImage.Handle, AScaleFactor);
|
QImage_setDevicePixelRatio(QtDC.vImage.Handle, AScaleFactor);
|
||||||
QPainter_begin(QtDC.Widget, QtDC.vImage.Handle);
|
QPainter_begin(QtDC.Widget, QtDC.vImage.Handle);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TQtWidgetSet.SetEventHandlerFlags(AHandler: PEventHandler;
|
procedure TQtWidgetSet.SetEventHandlerFlags(AHandler: PEventHandler;
|
||||||
NewFlags: dword);
|
NewFlags: dword);
|
||||||
|
@ -892,12 +892,15 @@ var
|
|||||||
QtDc: TQtDeviceContext absolute DC;
|
QtDc: TQtDeviceContext absolute DC;
|
||||||
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
|
||||||
|
if not SameValue(AScaleFactor, QImage_devicePixelRatio(QtDC.vImage.Handle)) then
|
||||||
begin
|
begin
|
||||||
QPainter_end(QtDC.Widget);
|
QPainter_end(QtDC.Widget);
|
||||||
QImage_setDevicePixelRatio(QtDC.vImage.Handle, AScaleFactor);
|
QImage_setDevicePixelRatio(QtDC.vImage.Handle, AScaleFactor);
|
||||||
QPainter_begin(QtDC.Widget, QtDC.vImage.Handle);
|
QPainter_begin(QtDC.Widget, QtDC.vImage.Handle);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TQtWidgetSet.SetEventHandlerFlags(AHandler: PEventHandler;
|
procedure TQtWidgetSet.SetEventHandlerFlags(AHandler: PEventHandler;
|
||||||
NewFlags: dword);
|
NewFlags: dword);
|
||||||
|
Loading…
Reference in New Issue
Block a user