mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 16:39:15 +02:00
Qt,Qt5: fixed AppRun when called with Application.Terminated - eg. app terminated in mainform.OnShow when using QtUseNativeEventLoop. part of Issue #34982
git-svn-id: branches/fixes_2_0@60289 -
This commit is contained in:
parent
7e5b882e03
commit
2c9ab572d6
@ -297,14 +297,22 @@ var
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
{$IFDEF QtUseNativeEventLoop}
|
{$IFDEF QtUseNativeEventLoop}
|
||||||
ATimer := QTimer_create(QCoreApplication_instance());
|
if Application.Terminated then
|
||||||
if (StyleName = 'gtk') or (StyleName = 'gtk+') then
|
begin
|
||||||
QTimer_setInterval(ATimer, 1) {issue #31191}
|
// application can be terminated in show event of mainform (before AppRun is called - see TApplication.Run. related to #34982)
|
||||||
else
|
if Assigned(ALoop) then
|
||||||
QTimer_setInterval(ATimer, 0);
|
ALoop;
|
||||||
QTimer_start(ATimer);
|
end else
|
||||||
FMainTimerID := QTimer_timerId(ATimer);
|
begin
|
||||||
QApplication_exec();
|
ATimer := QTimer_create(QCoreApplication_instance());
|
||||||
|
if (StyleName = 'gtk') or (StyleName = 'gtk+') then
|
||||||
|
QTimer_setInterval(ATimer, 1) {issue #31191}
|
||||||
|
else
|
||||||
|
QTimer_setInterval(ATimer, 0);
|
||||||
|
QTimer_start(ATimer);
|
||||||
|
FMainTimerID := QTimer_timerId(ATimer);
|
||||||
|
QApplication_exec();
|
||||||
|
end;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
// use LCL loop
|
// use LCL loop
|
||||||
if Assigned(ALoop) then
|
if Assigned(ALoop) then
|
||||||
|
@ -474,11 +474,9 @@ begin
|
|||||||
ACustomForm := TCustomForm(AWinControl);
|
ACustomForm := TCustomForm(AWinControl);
|
||||||
Widget := TQtMainWindow(AWinControl.Handle);
|
Widget := TQtMainWindow(AWinControl.Handle);
|
||||||
|
|
||||||
{$IFNDEF QtUseNativeEventLoop}
|
|
||||||
{issue #34982}
|
{issue #34982}
|
||||||
if AWinControl.HandleObjectShouldBeVisible and Application.Terminated then
|
if AWinControl.HandleObjectShouldBeVisible and Application.Terminated then
|
||||||
exit;
|
exit;
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
if AWinControl.HandleObjectShouldBeVisible then
|
if AWinControl.HandleObjectShouldBeVisible then
|
||||||
begin
|
begin
|
||||||
|
@ -245,15 +245,23 @@ var
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
{$IFDEF QtUseNativeEventLoop}
|
{$IFDEF QtUseNativeEventLoop}
|
||||||
FMainTimerID := -1;
|
if Application.Terminated then
|
||||||
ATimer := QTimer_Create(QCoreApplication_instance());
|
begin
|
||||||
if (StyleName = 'gtk') or (StyleName = 'gtk+') then
|
// application can be terminated in show event of mainform (before AppRun is called - see TApplication.Run. related to #34982)
|
||||||
QTimer_setInterval(ATimer, 1) {issue #31191}
|
if Assigned(ALoop) then
|
||||||
else
|
ALoop;
|
||||||
QTimer_setInterval(ATimer, {$IFDEF QtCocoa}1{$ELSE} 0 {$ENDIF});
|
end else
|
||||||
QTimer_start(ATimer);
|
begin
|
||||||
FMainTimerID := QTimer_timerId(ATimer);
|
FMainTimerID := -1;
|
||||||
QApplication_exec();
|
ATimer := QTimer_Create(QCoreApplication_instance());
|
||||||
|
if (StyleName = 'gtk') or (StyleName = 'gtk+') then
|
||||||
|
QTimer_setInterval(ATimer, 1) {issue #31191}
|
||||||
|
else
|
||||||
|
QTimer_setInterval(ATimer, {$IFDEF QtCocoa}1{$ELSE} 0 {$ENDIF});
|
||||||
|
QTimer_start(ATimer);
|
||||||
|
FMainTimerID := QTimer_timerId(ATimer);
|
||||||
|
QApplication_exec();
|
||||||
|
end;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
// use LCL loop
|
// use LCL loop
|
||||||
if Assigned(ALoop) then
|
if Assigned(ALoop) then
|
||||||
|
@ -479,12 +479,9 @@ begin
|
|||||||
|
|
||||||
Widget := TQtMainWindow(AWinControl.Handle);
|
Widget := TQtMainWindow(AWinControl.Handle);
|
||||||
|
|
||||||
|
|
||||||
{$IFNDEF QtUseNativeEventLoop}
|
|
||||||
{issue #34982}
|
{issue #34982}
|
||||||
if AWinControl.HandleObjectShouldBeVisible and Application.Terminated then
|
if AWinControl.HandleObjectShouldBeVisible and Application.Terminated then
|
||||||
exit;
|
exit;
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
if AWinControl.HandleObjectShouldBeVisible then
|
if AWinControl.HandleObjectShouldBeVisible then
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user