Qt: fixed infinite loop inside mdiarea when we switch mdi children

git-svn-id: trunk@33326 -
This commit is contained in:
zeljko 2011-11-05 08:58:36 +00:00
parent 5f414bbf0f
commit 1b878cad7d
2 changed files with 13 additions and 9 deletions

View File

@ -581,17 +581,23 @@ begin
FillChar(Msg, SizeOf(Msg), 0);
if OldWidget <> nil then
begin
//WriteLn('KILL: ', OldWidget.LCLObject.ClassName);
// WriteLn('KILL: ', OldWidget.LCLObject.ClassName);
Msg.msg := LM_KILLFOCUS;
Msg.wParam := PtrInt(NewWidget);
OldWidget.DeliverMessage(Msg);
if (OldWidget is TQtMainWindow) and (TQtMainWindow(OldWidget).IsMdiChild) then
TQtMainWindow(OldWidget).SlotActivateWindow(False)
else
OldWidget.DeliverMessage(Msg);
end;
if NewWidget <> nil then
begin
//WriteLn('SET: ', NewWidget.LCLObject.ClassName);
// WriteLn('SET: ', NewWidget.LCLObject.ClassName);
Msg.msg := LM_SETFOCUS;
Msg.wParam := PtrInt(OldWidget);
NewWidget.DeliverMessage(Msg);
if (NewWidget is TQtMainWindow) and (TQtMainWindow(NewWidget).IsMdiChild) then
TQtMainWindow(OldWidget).SlotActivateWindow(True)
else
NewWidget.DeliverMessage(Msg);
end;
end;

View File

@ -213,11 +213,9 @@ begin
if (AForm.FormStyle in [fsMDIChild]) and
(Application.MainForm.FormStyle = fsMdiForm) and
not (csDesigning in AWinControl.ComponentState) then
begin
QMdiArea_addSubWindow(TQtMainWindow(Application.MainForm.Handle).MDIAreaHandle, QtMainWindow.Widget, QtWindow);
QWidget_setFocusProxy(QtMainWindow.Widget, QtMainWindow.getContainerWidget);
end;
QMdiArea_addSubWindow(TQtMainWindow(Application.MainForm.Handle).MDIAreaHandle,
QtMainWindow.Widget, QtWindow);
// Return the handle
Result := TLCLIntfHandle(QtMainWindow);