From 8308cf24d579f4e0269d8055103d18c8da748c8b Mon Sep 17 00:00:00 2001 From: zeljko Date: Mon, 14 Feb 2011 13:23:54 +0000 Subject: [PATCH] Qt: creation of QMainWindow class could fail in case when splash screen is shown before Application.MainForm is created, so we never have MainForm=True (eg. lazarus on win32 - triggers sometimes).Returned checking of QKeySequence_isEmpty() for global actions. git-svn-id: trunk@29545 - --- lcl/interfaces/qt/qtwidgets.pas | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index c32bd1332a..866d635646 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -4698,7 +4698,6 @@ end; function TQtMainWindow.CreateWidget(const AParams: TCreateParams): QWidgetH; var - w: QWidgetH; p: QPaletteH; begin // Creates the widget @@ -4713,14 +4712,11 @@ begin FPopupMode := pmNone; FPopupParent := nil; - IsMainForm := False; + IsMainForm := (LCLObject <> nil) and (LCLObject = Application.MainForm); - w := QApplication_activeWindow; - if not Assigned(w) and not ((Application.MainForm <> nil) and (Application.MainForm.Visible)) - and (TCustomForm(LCLObject).FormStyle <> fsSplash) then + if IsMainForm then begin - - IsMainForm := True; + Result := QMainWindow_create(nil, QtWindow); {$ifdef darwin} @@ -11163,17 +11159,20 @@ begin Action := QActionH(Actions[i]); seq := QKeySequence_create(); try - QAction_shortcut(Action, seq); - WStr := ''; - QAction_text(Action, @WStr); - QKeySequence_destroy(seq); - seq := nil; - seq := QKeySequence_create(); - QKeySequence_mnemonic(seq, @WStr); - if not QKeySequence_isEmpty(seq) then + if QKeySequence_isEmpty(seq) then begin - QAction_setShortcutContext(Action, QtApplicationShortcut); - QtWidgetSet.AddGlobalAction(Action); + QAction_shortcut(Action, seq); + WStr := ''; + QAction_text(Action, @WStr); + QKeySequence_destroy(seq); + seq := nil; + seq := QKeySequence_create(); + QKeySequence_mnemonic(seq, @WStr); + if not QKeySequence_isEmpty(seq) then + begin + QAction_setShortcutContext(Action, QtApplicationShortcut); + QtWidgetSet.AddGlobalAction(Action); + end; end; finally QKeySequence_destroy(seq);