qt: workaround GetWindowRect bug

git-svn-id: trunk@13979 -
This commit is contained in:
paul 2008-02-05 05:57:24 +00:00
parent 0d97ad6200
commit d9f544ab7f
2 changed files with 17 additions and 0 deletions

View File

@ -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);

View File

@ -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;