mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 12:59:16 +02:00
qt: fix SelectClipRgn which is uses device coordinates and Qt uses logical
git-svn-id: trunk@24166 -
This commit is contained in:
parent
df57e9f69f
commit
518fc97931
@ -290,6 +290,7 @@ type
|
|||||||
function GetRegionType: integer;
|
function GetRegionType: integer;
|
||||||
function getBoundingRect: TRect;
|
function getBoundingRect: TRect;
|
||||||
function numRects: Integer;
|
function numRects: Integer;
|
||||||
|
procedure translate(dx, dy: Integer);
|
||||||
property IsPolyRegion: Boolean read GetIsPolyRegion;
|
property IsPolyRegion: Boolean read GetIsPolyRegion;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1798,6 +1799,11 @@ begin
|
|||||||
Result := QRegion_numRects(Widget);
|
Result := QRegion_numRects(Widget);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TQtRegion.translate(dx, dy: Integer);
|
||||||
|
begin
|
||||||
|
QRegion_translate(Widget, dx, dy);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TQtDeviceContext }
|
{ TQtDeviceContext }
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
@ -4312,6 +4312,7 @@ function TQtWidgetSet.SelectClipRGN(DC: hDC; RGN: HRGN): Longint;
|
|||||||
var
|
var
|
||||||
QtDC: TQtDeviceContext;
|
QtDC: TQtDeviceContext;
|
||||||
EmptyRegion: QRegionH;
|
EmptyRegion: QRegionH;
|
||||||
|
P: TPoint;
|
||||||
begin
|
begin
|
||||||
Result := ERROR;
|
Result := ERROR;
|
||||||
if IsValidDC(DC) then
|
if IsValidDC(DC) then
|
||||||
@ -4320,6 +4321,10 @@ begin
|
|||||||
if IsValidGDIObject(RGN) then
|
if IsValidGDIObject(RGN) then
|
||||||
begin
|
begin
|
||||||
Result := TQtRegion(Rgn).GetRegionType;
|
Result := TQtRegion(Rgn).GetRegionType;
|
||||||
|
// RGN is in Device coordinates. Qt expects logical coordinates
|
||||||
|
// so we need to convert RGN coords
|
||||||
|
GetWindowOrgEx(DC, @P);
|
||||||
|
TQtRegion(Rgn).translate(P.X, P.Y);
|
||||||
QtDC.setClipRegion(TQtRegion(Rgn).Widget);
|
QtDC.setClipRegion(TQtRegion(Rgn).Widget);
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user