Qt: fixed wrong TQtWidgetSet.SetParent() behaviour. Flags shouldn't be setted up if form is reparented to other control.

git-svn-id: trunk@30223 -
This commit is contained in:
zeljko 2011-04-06 16:15:18 +00:00
parent b48287dbb8
commit 0048e84bad

View File

@ -5021,13 +5021,29 @@ function TQtWidgetSet.SetParent(hWndChild: HWND; hWndParent: HWND): HWND;
var
OldVisible: Boolean;
Flags: QtWindowFlags;
W: TQtWidget;
begin
{$ifdef VerboseQtWinAPI}
writeln('[WinApi SetParent] child: ',dbgHex(PtrUInt(hwndChild)),
' parent: ',dbgHex(PtrUInt(hWndParent)));
{$endif}
Result := 0;
if not IsValidHandle(hwndChild) then
exit;
Result := GetParent(hWndChild);
OldVisible := TQtWidget(hWndChild).getVisible;
Flags := TQtWidget(hWndChild).windowFlags;
TQtWidget(hWndChild).setParent(TQtWidget(hWndParent).GetContainerWidget);
TQtWidget(hWndChild).setWindowFlags(Flags);
TQtWidget(hWndChild).setVisible(OldVisible);
if (Result = hwndParent) then
exit;
W := TQtWidget(hWndChild);
OldVisible := W.getVisible;
Flags := W.windowFlags;
if IsValidHandle(hWndParent) then
W.setParent(TQtWidget(hWndParent).GetContainerWidget)
else
begin
W.setParent(nil);
W.setWindowFlags(Flags);
end;
W.setVisible(OldVisible);
end;
function TQtWidgetSet.SetMapMode(DC: HDC; fnMapMode : Integer): Integer;
@ -5577,7 +5593,7 @@ var
Widget: TQtWidget;
begin
{$ifdef VerboseQtWinAPI}
WriteLn('[WinAPI ShowWindow]');
WriteLn('[WinAPI ShowWindow] hwnd ',dbgHex(PtrUInt(hWnd)),' nCmdShow ',nCmdShow);
{$endif}
Result := False;