mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 17:19:22 +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 getBoundingRect: TRect;
|
||||
function numRects: Integer;
|
||||
procedure translate(dx, dy: Integer);
|
||||
property IsPolyRegion: Boolean read GetIsPolyRegion;
|
||||
end;
|
||||
|
||||
@ -1798,6 +1799,11 @@ begin
|
||||
Result := QRegion_numRects(Widget);
|
||||
end;
|
||||
|
||||
procedure TQtRegion.translate(dx, dy: Integer);
|
||||
begin
|
||||
QRegion_translate(Widget, dx, dy);
|
||||
end;
|
||||
|
||||
{ TQtDeviceContext }
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -4312,6 +4312,7 @@ function TQtWidgetSet.SelectClipRGN(DC: hDC; RGN: HRGN): Longint;
|
||||
var
|
||||
QtDC: TQtDeviceContext;
|
||||
EmptyRegion: QRegionH;
|
||||
P: TPoint;
|
||||
begin
|
||||
Result := ERROR;
|
||||
if IsValidDC(DC) then
|
||||
@ -4320,6 +4321,10 @@ begin
|
||||
if IsValidGDIObject(RGN) then
|
||||
begin
|
||||
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);
|
||||
end else
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user