mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 06:59:14 +02:00
Qt: pascalified mapToGlobal() and mapFromGlobal()
git-svn-id: trunk@34151 -
This commit is contained in:
parent
c7d4748e81
commit
f45d3703b2
@ -255,6 +255,8 @@ type
|
|||||||
function isFullScreen: Boolean;
|
function isFullScreen: Boolean;
|
||||||
function IsWindow: Boolean;
|
function IsWindow: Boolean;
|
||||||
procedure lowerWidget; virtual;
|
procedure lowerWidget; virtual;
|
||||||
|
function MapToGlobal(APt: TPoint; const AWithScrollOffset: Boolean = False): TPoint; virtual;
|
||||||
|
function MapFromGlobal(APt: TPoint; const AWithScrollOffset: Boolean = False): TPoint; virtual;
|
||||||
procedure move(ANewLeft, ANewTop: Integer); virtual;
|
procedure move(ANewLeft, ANewTop: Integer); virtual;
|
||||||
procedure preferredSize(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); virtual;
|
procedure preferredSize(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); virtual;
|
||||||
procedure raiseWidget; virtual;
|
procedure raiseWidget; virtual;
|
||||||
@ -451,6 +453,8 @@ type
|
|||||||
public
|
public
|
||||||
function CanAdjustClientRectOnResize: Boolean; override;
|
function CanAdjustClientRectOnResize: Boolean; override;
|
||||||
function cornerWidget: TQtWidget;
|
function cornerWidget: TQtWidget;
|
||||||
|
function MapToGlobal(APt: TPoint; const AWithScrollOffset: Boolean = False): TPoint; override;
|
||||||
|
function MapFromGlobal(APt: TPoint; const AWithScrollOffset: Boolean = False): TPoint; override;
|
||||||
function viewport: TQtViewPort;
|
function viewport: TQtViewPort;
|
||||||
procedure preferredSize(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); override;
|
procedure preferredSize(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); override;
|
||||||
procedure setCornerWidget(AWidget: TQtWidget);
|
procedure setCornerWidget(AWidget: TQtWidget);
|
||||||
@ -4006,6 +4010,24 @@ begin
|
|||||||
QWidget_lower(Widget);
|
QWidget_lower(Widget);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQtWidget.MapToGlobal(APt: TPoint;
|
||||||
|
const AWithScrollOffset: Boolean = False): TPoint;
|
||||||
|
var
|
||||||
|
Pt: TQtPoint;
|
||||||
|
begin
|
||||||
|
Pt := QtPoint(APt.X, APt.Y);
|
||||||
|
QWidget_mapToGlobal(GetContainerWidget, @Result, @Pt);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TQtWidget.MapFromGlobal(APt: TPoint;
|
||||||
|
const AWithScrollOffset: Boolean = False): TPoint;
|
||||||
|
var
|
||||||
|
Pt: TQtPoint;
|
||||||
|
begin
|
||||||
|
Pt := QtPoint(APt.X, APt.Y);
|
||||||
|
QWidget_mapFromGlobal(GetContainerWidget, @Result, @Pt);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TQtWidget.move(ANewLeft, ANewTop: Integer);
|
procedure TQtWidget.move(ANewLeft, ANewTop: Integer);
|
||||||
begin
|
begin
|
||||||
QWidget_move(Widget, ANewLeft, ANewTop);
|
QWidget_move(Widget, ANewLeft, ANewTop);
|
||||||
@ -13571,6 +13593,27 @@ begin
|
|||||||
Result := FCornerWidget;
|
Result := FCornerWidget;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQtCustomControl.MapToGlobal(APt: TPoint;
|
||||||
|
const AWithScrollOffset: Boolean = False): TPoint;
|
||||||
|
var
|
||||||
|
Pt: TPoint;
|
||||||
|
begin
|
||||||
|
Result := inherited MapToGlobal(APt);
|
||||||
|
if AWithScrollOffset and (ChildOfComplexWidget = ccwScrollingWinControl) then
|
||||||
|
begin
|
||||||
|
Pt := viewport.ScrolledOffset;
|
||||||
|
dec(Result.X, Pt.X);
|
||||||
|
dec(Result.Y, Pt.Y);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TQtCustomControl.MapFromGlobal(APt: TPoint;
|
||||||
|
const AWithScrollOffset: Boolean = False): TPoint;
|
||||||
|
begin
|
||||||
|
//TODO: see what to do with ccwScrollingWinControl
|
||||||
|
Result := inherited MapFromGlobal(APt);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: TQtCustomControl.setCornerWidget
|
Function: TQtCustomControl.setCornerWidget
|
||||||
Params: TQtWidget
|
Params: TQtWidget
|
||||||
|
@ -158,18 +158,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := IsValidHandle(Handle);
|
Result := IsValidHandle(Handle);
|
||||||
if Result then
|
if Result then
|
||||||
begin
|
P := TQtWidget(Handle).MapToGlobal(P, True);
|
||||||
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;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -5168,9 +5157,7 @@ begin
|
|||||||
Result := 0;
|
Result := 0;
|
||||||
if IsValidHandle(Handle) then
|
if IsValidHandle(Handle) then
|
||||||
begin
|
begin
|
||||||
APoint := QtPoint(P.X, P.Y);
|
P := TQtWidget(Handle).MapFromGlobal(P);
|
||||||
QWidget_mapFromGlobal(TQtWidget(Handle).GetContainerWidget, @APoint, @APoint);
|
|
||||||
P := Point(APoint.x, APoint.y);
|
|
||||||
Result := 1;
|
Result := 1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user