* Reimplemented modal forms handling.

* Fixed bug with invisible statusbar under linux.

git-svn-id: trunk@11481 -
This commit is contained in:
zeljko 2007-07-13 08:12:35 +00:00
parent 8c0501c443
commit bfa0163c4c
3 changed files with 19 additions and 23 deletions

View File

@ -35,7 +35,7 @@ uses
{$endif}
qtwidgets, qtprivate, qtobjects,
// LCL
Classes, ComCtrls, Controls, LCLType, Graphics, LCLProc, LCLIntf,
Classes, ComCtrls, Controls, LCLType, Graphics, LCLProc, LCLIntf, Forms,
// Widgetset
WSProc, WSComCtrls, WSLCLClasses;
@ -569,6 +569,15 @@ begin
end;
end;
{some systems doesn't show statusbar inside mainwindow
(linux tested on FC3,FC4,FC7 ).}
{$ifdef linux}
if Assigned(AWinControl.Parent)
and (AWinControl.Parent.Handle = Application.MainForm.Handle)
then
QMainWindow_setStatusBar(QMainWindowH(TQtMainWindow(AWinControl.Parent.Handle).Widget), QStatusBarH(QtStatusBar.Widget));
{$endif}
// Return handle
Result := THandle(QtStatusBar);

View File

@ -190,7 +190,14 @@ begin
Widget := TQtWidget(AWinControl.Handle);
{ if the widget is a form, this is a place to set the Tab order }
if AWinControl.HandleObjectShouldBeVisible and (Widget is TQtMainWindow) then
begin
if fsModal in TForm(AWinControl).FormState then
begin
QWidget_setWindowFlags(Widget.Widget, QtDialog);
Widget.setWindowModality(QtApplicationModal);
end;
TQtMainWindow(Widget).SetTabOrders;
end;
if AWinControl.HandleObjectShouldBeVisible then
QWidget_setVisible(Widget.Widget, True)

View File

@ -22,7 +22,7 @@
}
unit QtWSForms;
{$mode delphi}{$H+}
{$mode objfpc}{$H+}
interface
@ -286,27 +286,7 @@ end;
------------------------------------------------------------------------------}
class procedure TQtWSCustomForm.ShowModal(const ACustomForm: TCustomForm);
begin
{$ifdef VerboseQt}
WriteLn('Trace:> [TQtWSCustomForm.ShowModal]');
{$endif}
{if we use QDialog as modal class then everything looks fine}
TQtWidget(ACustomForm.Handle).Hide;
TQtWidget(ACustomForm.Handle).setWindowModality(QtApplicationModal);
TQtWidget(ACustomForm.Handle).Show;
Application.ProcessMessages;
sleep(10);
Application.ProcessMessages;
{BUG: if we assign OnCloseQuery(), Lazarus TCustomForm.Close() Fires ModalResult = mrCancel,
without counting on OnCloseQuery() result (CanClose), so if we set it up we'll jump over our
loop, and then comes into LCL loop with WidgetSet.AppProcessMessages
which burns CPU ...}
{$ifdef VerboseQt}
WriteLn('Trace:< [TQtWSCustomForm.ShowModal]');
{$endif}
{TODO: fix cpu burning , we need an sleep(0) in LCL modal loop}
end;
{------------------------------------------------------------------------------