mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-01 08:09:28 +02:00
Qt: fixed wrong result of TQtWidgetSet.ClientToScreen() in case of scrolling win control.Part of issue #18272
git-svn-id: trunk@31583 -
This commit is contained in:
parent
961c9aa9b9
commit
5f6ebb3560
@ -124,6 +124,7 @@ type
|
||||
|
||||
function GetPalette: TQtWidgetPalette;
|
||||
function GetProps(const AnIndex: String): pointer;
|
||||
function getScrolledOffset: TPoint;
|
||||
function GetStyleSheet: WideString;
|
||||
function GetWidget: QWidgetH;
|
||||
function LCLKeyToQtKey(AKey: Word): Integer;
|
||||
@ -291,6 +292,7 @@ type
|
||||
property HasPaint: Boolean read FHasPaint write FHasPaint;
|
||||
property KeysToEat: TByteSet read FKeysToEat write FKeysToEat;
|
||||
property LastCaretPos: TQtPoint read FLastCaretPos write SetLastCaretPos;
|
||||
property ScrolledOffset: TPoint read getScrolledOffset;
|
||||
property StyleSheet: WideString read GetStyleSheet write SetStyleSheet;
|
||||
property PaintData: TPaintData read FPaintData write FPaintData;
|
||||
property Palette: TQtWidgetPalette read GetPalette;
|
||||
@ -4463,6 +4465,11 @@ begin
|
||||
result := nil;
|
||||
end;
|
||||
|
||||
function TQtWidget.getScrolledOffset: TPoint;
|
||||
begin
|
||||
Result := Point(-FScrollX, -FScrollY);
|
||||
end;
|
||||
|
||||
function TQtWidget.GetStyleSheet: WideString;
|
||||
var
|
||||
WStr: WideString;
|
||||
|
||||
@ -154,6 +154,7 @@ end;
|
||||
function TQtWidgetSet.ClientToScreen(Handle: HWND; var P: TPoint) : Boolean;
|
||||
var
|
||||
APoint: TQtPoint;
|
||||
Pt: TPoint;
|
||||
begin
|
||||
Result := Handle <> 0;
|
||||
if Result then
|
||||
@ -161,6 +162,12 @@ begin
|
||||
APoint := QtPoint(P.X, P.Y);
|
||||
|
||||
QWidget_mapToGlobal(TQtWidget(Handle).GetContainerWidget, @APoint, @APoint);
|
||||
if TQtWidget(Handle).ChildOfComplexWidget = ccwScrollingWinControl then
|
||||
begin
|
||||
Pt := TQtCustomControl(Handle).viewport.ScrolledOffset;
|
||||
dec(APoint.X, Pt.X);
|
||||
dec(APoint.Y, Pt.Y);
|
||||
end;
|
||||
P := Point(APoint.x, APoint.y);
|
||||
end;
|
||||
end;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user