mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-31 06:41:00 +02:00
* Fix MDIChilds due to LayoutWidget & CentralWidget commits.
git-svn-id: trunk@11513 -
This commit is contained in:
parent
2725083a1f
commit
91a249f4e0
@ -1004,9 +1004,9 @@ begin
|
|||||||
QEventHide: SlotShow(False);
|
QEventHide: SlotShow(False);
|
||||||
QEventClose:
|
QEventClose:
|
||||||
begin
|
begin
|
||||||
Result:=True;
|
Result := True;
|
||||||
QEvent_ignore(Event);
|
QEvent_ignore(Event);
|
||||||
SlotClose;
|
SlotClose;
|
||||||
end;
|
end;
|
||||||
QEventDestroy: SlotDestroy;
|
QEventDestroy: SlotDestroy;
|
||||||
QEventFocusIn: SlotFocus(True);
|
QEventFocusIn: SlotFocus(True);
|
||||||
@ -2185,9 +2185,6 @@ end;
|
|||||||
function TQtMainWindow.CreateWidget(const AParams: TCreateParams): QWidgetH;
|
function TQtMainWindow.CreateWidget(const AParams: TCreateParams): QWidgetH;
|
||||||
var
|
var
|
||||||
w: QWidgetH;
|
w: QWidgetH;
|
||||||
{$ifdef USE_QT_4_3}
|
|
||||||
mdihandle: QMdiAreaH;
|
|
||||||
{$endif}
|
|
||||||
begin
|
begin
|
||||||
// Creates the widget
|
// Creates the widget
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
@ -2241,11 +2238,18 @@ begin
|
|||||||
{$ifdef USE_QT_4_3}
|
{$ifdef USE_QT_4_3}
|
||||||
if (LCLObject is TCustomForm) and (TCustomForm(LCLObject).FormStyle = fsMDIChild) then
|
if (LCLObject is TCustomForm) and (TCustomForm(LCLObject).FormStyle = fsMDIChild) then
|
||||||
begin
|
begin
|
||||||
Result := QMdiSubWindow_create(niL, QtWindow);
|
|
||||||
|
if TQtMainWindow(Application.MainForm.Handle).MDIAreaHandle = nil
|
||||||
mdiHandle := TQtMainWindow(Application.MainForm.Handle).MDIAreaHandle;
|
then
|
||||||
if Assigned(mdiHandle) then
|
raise Exception.Create('MDIChild can be added to MDIForm only !');
|
||||||
QMdiArea_addSubWindow(mdiHandle, QMdiSubWindowH(Result), QtWindow);
|
|
||||||
|
Result := QMdiSubWindow_create(nil, QtWindow);
|
||||||
|
|
||||||
|
// QMdiSubWindow already have an layout
|
||||||
|
LayoutWidget := QBoxLayoutH(QWidget_layout(Result));
|
||||||
|
if LayoutWidget <> nil
|
||||||
|
then
|
||||||
|
QBoxLayout_destroy(LayoutWidget);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Result := QWidget_create(nil, QtWindow);
|
Result := QWidget_create(nil, QtWindow);
|
||||||
|
@ -35,7 +35,7 @@ uses
|
|||||||
{$endif}
|
{$endif}
|
||||||
qtwidgets,
|
qtwidgets,
|
||||||
// LCL
|
// LCL
|
||||||
SysUtils, Controls, LCLType, Forms,
|
SysUtils, Classes, Controls, LCLType, Forms,
|
||||||
// Widgetset
|
// Widgetset
|
||||||
InterfaceBase, WSForms, WSLCLClasses;
|
InterfaceBase, WSForms, WSLCLClasses;
|
||||||
|
|
||||||
@ -144,6 +144,7 @@ class function TQtWSCustomForm.CreateHandle(const AWinControl: TWinControl;
|
|||||||
var
|
var
|
||||||
QtMainWindow: TQtMainWindow;
|
QtMainWindow: TQtMainWindow;
|
||||||
Str: WideString;
|
Str: WideString;
|
||||||
|
R: TRect;
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
WriteLn('[TQtWSCustomForm.CreateHandle] Height: ', IntToStr(AWinControl.Height),
|
WriteLn('[TQtWSCustomForm.CreateHandle] Height: ', IntToStr(AWinControl.Height),
|
||||||
@ -154,7 +155,8 @@ begin
|
|||||||
|
|
||||||
QtMainWindow := TQtMainWindow.Create(AWinControl, AParams);
|
QtMainWindow := TQtMainWindow.Create(AWinControl, AParams);
|
||||||
|
|
||||||
if (TCustomForm(AWinControl).ShowInTaskBar in [stDefault, stNever]) and
|
if (TCustomForm(AWinControl).ShowInTaskBar in [stDefault, stNever]) and not
|
||||||
|
(TCustomForm(AWinControl).FormStyle in [fsMDIChild]) and
|
||||||
(Application <> nil) and
|
(Application <> nil) and
|
||||||
(Application.MainForm <> nil) and
|
(Application.MainForm <> nil) and
|
||||||
(Application.MainForm.HandleAllocated) and
|
(Application.MainForm.HandleAllocated) and
|
||||||
@ -173,6 +175,20 @@ begin
|
|||||||
|
|
||||||
// Sets Various Events
|
// Sets Various Events
|
||||||
QtMainWindow.AttachEvents;
|
QtMainWindow.AttachEvents;
|
||||||
|
|
||||||
|
{$ifdef USE_QT_4_3}
|
||||||
|
if (TCustomForm(AWinControl).FormStyle in [fsMDIChild])
|
||||||
|
and (Application.MainForm.FormStyle = fsMdiForm)
|
||||||
|
then
|
||||||
|
begin
|
||||||
|
QWidget_geometry(QtMainWindow.MenuBar.Widget, @R);
|
||||||
|
QMdiArea_addSubWindow(TQtMainWindow(Application.MainForm.Handle).MDIAreaHandle, QtMainWindow.Widget, QtWindow);
|
||||||
|
AWinControl.Height := AWinControl.Height + R.Bottom;
|
||||||
|
{TODO: Show MDIChild Left&Top +10 of last created mdi child}
|
||||||
|
AWinControl.Left := 0;
|
||||||
|
AWinControl.Top := 0;
|
||||||
|
end;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
// Return the handle
|
// Return the handle
|
||||||
Result := THandle(QtMainWindow);
|
Result := THandle(QtMainWindow);
|
||||||
@ -286,7 +302,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
class procedure TQtWSCustomForm.ShowModal(const ACustomForm: TCustomForm);
|
class procedure TQtWSCustomForm.ShowModal(const ACustomForm: TCustomForm);
|
||||||
begin
|
begin
|
||||||
{TODO: fix cpu burning , we need an sleep(0) in LCL modal loop}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user