Qt: fixed proper restoring of forms in AppRestore (eg. maximized forms)

git-svn-id: trunk@25449 -
This commit is contained in:
zeljko 2010-05-15 21:27:29 +00:00
parent efdcd83830
commit 05f1f285ca
2 changed files with 13 additions and 10 deletions

View File

@ -66,7 +66,6 @@ type
FAppEvenFilterHook: QObject_hookH; FAppEvenFilterHook: QObject_hookH;
FAppFocusChangedHook: QApplication_hookH; FAppFocusChangedHook: QApplication_hookH;
FOldFocusWidget: QWidgetH;
FDockImage: QRubberBandH; FDockImage: QRubberBandH;
FDragImageList: QWidgetH; FDragImageList: QWidgetH;
FDragHotSpot: TPoint; FDragHotSpot: TPoint;

View File

@ -121,8 +121,6 @@ var
begin begin
WakeMainThread := @OnWakeMainThread; WakeMainThread := @OnWakeMainThread;
FOldFocusWidget := nil;
{ {
check whether this hook crashes on linux & darwin and why it is so check whether this hook crashes on linux & darwin and why it is so
we need this hook to catch release messages we need this hook to catch release messages
@ -220,6 +218,7 @@ procedure TQtWidgetSet.AppMinimize;
var var
i: Integer; i: Integer;
AForm: TCustomForm; AForm: TCustomForm;
States: QtWindowStates;
{$ENDIF} {$ENDIF}
begin begin
if (Application.MainForm <> nil) and (Application.MainForm.HandleAllocated) then if (Application.MainForm <> nil) and (Application.MainForm.HandleAllocated) then
@ -236,9 +235,11 @@ begin
) )
and and
not (AForm.FormStyle in [fsMDIChild, fsSplash]) and not (AForm.FormStyle in [fsMDIChild, fsSplash]) and
not (AForm.BorderStyle in [bsNone]) not (AForm.BorderStyle in [bsNone]) then
then begin
TQtMainWindow(AForm.Handle).ShowMinimized; States := TQtMainWindow(AForm.Handle).getWindowState;
TQtMainWindow(AForm.Handle).setWindowState(States or QtWindowMinimized);
end;
end; end;
{$ELSE} {$ELSE}
TQtMainWindow(Application.MainForm.Handle).ShowMinimized; TQtMainWindow(Application.MainForm.Handle).ShowMinimized;
@ -251,6 +252,7 @@ procedure TQtWidgetSet.AppRestore;
var var
i: Integer; i: Integer;
AForm: TCustomForm; AForm: TCustomForm;
States: QtWindowStates;
{$ENDIF} {$ENDIF}
begin begin
if (Application.MainForm <> nil) and (Application.MainForm.HandleAllocated) then if (Application.MainForm <> nil) and (Application.MainForm.HandleAllocated) then
@ -268,9 +270,11 @@ begin
) )
and and
not (AForm.FormStyle in [fsMDIChild, fsSplash]) and not (AForm.FormStyle in [fsMDIChild, fsSplash]) and
not (AForm.BorderStyle in [bsNone]) not (AForm.BorderStyle in [bsNone]) then
then begin
TQtMainWindow(AForm.Handle).ShowNormal; States := TQtMainWindow(AForm.Handle).getWindowState;
TQtMainWindow(AForm.Handle).setWindowState(States and not QtWindowMinimized);
end;
end; end;
{$ELSE} {$ELSE}
TQtMainWindow(Application.MainForm.Handle).ShowNormal; TQtMainWindow(Application.MainForm.Handle).ShowNormal;