mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 02:29:21 +02:00
qt: workaround GetWindowRect bug
git-svn-id: trunk@13979 -
This commit is contained in:
parent
0d97ad6200
commit
d9f544ab7f
@ -157,6 +157,7 @@ type
|
||||
function getFrameGeometry: TRect;
|
||||
function getGeometry: TRect; virtual;
|
||||
function getVisible: Boolean; virtual;
|
||||
function getParent: QWidgetH;
|
||||
function getPos: TQtPoint;
|
||||
function getSize: TSize;
|
||||
function getText: WideString; virtual;
|
||||
@ -2475,6 +2476,11 @@ begin
|
||||
Result := QWidget_isVisible(Widget);
|
||||
end;
|
||||
|
||||
function TQtWidget.getParent: QWidgetH;
|
||||
begin
|
||||
Result := QWidget_parentWidget(Widget);
|
||||
end;
|
||||
|
||||
function TQtWidget.getPos: TQtPoint;
|
||||
begin
|
||||
QWidget_pos(Widget, @Result);
|
||||
|
@ -3119,6 +3119,7 @@ end;
|
||||
function TQtWidgetSet.GetWindowRect(Handle: HWND; var ARect: TRect): Integer;
|
||||
var
|
||||
APos: TQtPoint;
|
||||
AParent: QWidgetH;
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('[WinAPI GetWindowRect]');
|
||||
@ -3126,9 +3127,19 @@ begin
|
||||
|
||||
Result := 0;
|
||||
|
||||
{ // this code doesnot work sometimes - why? Maybe qt bug?
|
||||
// to test bug one can create 4 pannels with 0 sizes and aligned to differnt sides
|
||||
// then aligned to left and to right panel will return same value
|
||||
|
||||
APos.x := 0;
|
||||
APos.y := 0;
|
||||
QWidget_mapToGlobal(TQtWidget(Handle).Widget, @APos, @APos);
|
||||
}
|
||||
APos := TQtWidget(Handle).getPos;
|
||||
AParent := TQtWidget(Handle).getParent;
|
||||
if AParent <> nil then
|
||||
QWidget_mapToGlobal(AParent, @APos, @APos);
|
||||
|
||||
ARect.Left := APos.x;
|
||||
ARect.Top := APos.y;
|
||||
ARect.Bottom := ARect.Top + TQtWidget(Handle).getHeight;
|
||||
|
Loading…
Reference in New Issue
Block a user