diff --git a/lcl/interfaces/qt/qtwinapi.inc b/lcl/interfaces/qt/qtwinapi.inc index 73a9705c12..3d856ef793 100644 --- a/lcl/interfaces/qt/qtwinapi.inc +++ b/lcl/interfaces/qt/qtwinapi.inc @@ -90,10 +90,18 @@ end; Returns: ------------------------------------------------------------------------------} function TQtWidgetSet.ClientToScreen(Handle: HWND; var P: TPoint) : Boolean; +var + APoint: TQtPoint; begin Result := True; if Handle <> 0 then - QWidget_mapToGlobal(TQtWidget(Handle).Widget, @P, @P); + begin + APoint.x := P.X; + APoint.y := P.Y; + QWidget_mapToGlobal(TQtWidget(Handle).Widget, @APoint, @APoint); + P.X := APoint.x; + P.Y := APoint.y; + end; end; {------------------------------------------------------------------------------ @@ -2376,6 +2384,63 @@ begin Result := True; end; +{------------------------------------------------------------------------------ + Function: PolyBezier + Params: DC: HDC; Points: PPoint; NumPts: Integer; Filled: Boolean; + Continuous: Boolean + Returns: Nothing + ------------------------------------------------------------------------------} +function TQtWidgetSet.PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer; + Filled, Continuous: Boolean): Boolean; +begin + {$ifdef VerboseQtWinAPI} + WriteLn('[WinAPI PolyBezier] DC: ', dbghex(DC)); + {$endif} + Result := inherited PolyBezier(DC, Points, NumPts, Filled, Continuous); +end; + +{------------------------------------------------------------------------------ + Function: Polygon + Params: DC: HDC; Points: PPoint; NumPts: Integer; Winding: Boolean + Returns: Nothing + ------------------------------------------------------------------------------} +function TQtWidgetSet.Polygon(DC: HDC; Points: PPoint; NumPts: Integer; + Winding: Boolean): boolean; +var + ARect: TRect; + ADC : TQtDeviceContext; +begin + {$ifdef VerboseQtWinAPI} + WriteLn('[WinAPI Polygon] DC: ', dbghex(DC)); + {$endif} + Result := IsValidDC(DC); + if Result then + begin + {TODO: discuss with other developers about antialiasing by default} + // QPainter_setRenderHint(TQtDeviceContext(DC).Widget, QPainterAntialiasing, True); + if Winding + then + QPainter_drawPolygon(TQtDeviceContext(DC).Widget, PQtPoint(Points), NumPts, QtWindingFill) + else + QPainter_drawPolygon(TQtDeviceContext(DC).Widget, PQtPoint(Points), NumPts, QtOddEvenFill); + end; +end; + +{------------------------------------------------------------------------------ + Function: Polyline + Params: DC: HDC; Points: PPoint; NumPts: Integer + Returns: Nothing + ------------------------------------------------------------------------------} +function TQtWidgetSet.Polyline(DC: HDC; Points: PPoint; NumPts: Integer): boolean; +begin + {$ifdef VerboseQtWinAPI} + WriteLn('[WinAPI Polyline] DC: ', dbghex(DC)); + {$endif} + Result := IsValidDC(DC); + if Result then + QPainter_drawPolyline(TQtDeviceContext(DC).Widget, PQtPoint(Points), NumPts); +end; + {------------------------------------------------------------------------------ Function: Rectangle Params: DC: HDC; X1, Y1, X2, Y2: Integer diff --git a/lcl/interfaces/qt/qtwinapih.inc b/lcl/interfaces/qt/qtwinapih.inc index 0830bd2ff8..8a31581c36 100644 --- a/lcl/interfaces/qt/qtwinapih.inc +++ b/lcl/interfaces/qt/qtwinapih.inc @@ -95,6 +95,10 @@ function LineTo(DC: HDC; X, Y: Integer): Boolean; override; function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override; +function PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer; Filled, Continuous: boolean): boolean; override; +function Polygon(DC: HDC; Points: PPoint; NumPts: Integer; Winding: boolean): boolean; override; +function Polyline(DC: HDC; Points: PPoint; NumPts: Integer): boolean; override; + function Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean; override; function ReleaseDC(hWnd: HWND; DC: HDC): Integer; override; function RestoreDC(DC: HDC; SavedDC: Integer): Boolean; override;