mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 07:59:28 +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 getFrameGeometry: TRect;
|
||||||
function getGeometry: TRect; virtual;
|
function getGeometry: TRect; virtual;
|
||||||
function getVisible: Boolean; virtual;
|
function getVisible: Boolean; virtual;
|
||||||
|
function getParent: QWidgetH;
|
||||||
function getPos: TQtPoint;
|
function getPos: TQtPoint;
|
||||||
function getSize: TSize;
|
function getSize: TSize;
|
||||||
function getText: WideString; virtual;
|
function getText: WideString; virtual;
|
||||||
@ -2475,6 +2476,11 @@ begin
|
|||||||
Result := QWidget_isVisible(Widget);
|
Result := QWidget_isVisible(Widget);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQtWidget.getParent: QWidgetH;
|
||||||
|
begin
|
||||||
|
Result := QWidget_parentWidget(Widget);
|
||||||
|
end;
|
||||||
|
|
||||||
function TQtWidget.getPos: TQtPoint;
|
function TQtWidget.getPos: TQtPoint;
|
||||||
begin
|
begin
|
||||||
QWidget_pos(Widget, @Result);
|
QWidget_pos(Widget, @Result);
|
||||||
|
@ -3119,6 +3119,7 @@ end;
|
|||||||
function TQtWidgetSet.GetWindowRect(Handle: HWND; var ARect: TRect): Integer;
|
function TQtWidgetSet.GetWindowRect(Handle: HWND; var ARect: TRect): Integer;
|
||||||
var
|
var
|
||||||
APos: TQtPoint;
|
APos: TQtPoint;
|
||||||
|
AParent: QWidgetH;
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQtWinAPI}
|
{$ifdef VerboseQtWinAPI}
|
||||||
WriteLn('[WinAPI GetWindowRect]');
|
WriteLn('[WinAPI GetWindowRect]');
|
||||||
@ -3126,9 +3127,19 @@ begin
|
|||||||
|
|
||||||
Result := 0;
|
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.x := 0;
|
||||||
APos.y := 0;
|
APos.y := 0;
|
||||||
QWidget_mapToGlobal(TQtWidget(Handle).Widget, @APos, @APos);
|
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.Left := APos.x;
|
||||||
ARect.Top := APos.y;
|
ARect.Top := APos.y;
|
||||||
ARect.Bottom := ARect.Top + TQtWidget(Handle).getHeight;
|
ARect.Bottom := ARect.Top + TQtWidget(Handle).getHeight;
|
||||||
|
Loading…
Reference in New Issue
Block a user