Re: [Interest] QEvent::Quit vs. QEvent::Close
Hi, Can you elaborate on why you need to distinguish a quit from the Dock vs one initiated by qApp->quit()? See https://bugreports.qt.io/browse/QTBUG-118533 Cheers, Tor Arne On 23 Oct 2023, at 21:05, Alexander Dyagilev wrote: Hello, In Qt 5.x we had QEvent::Close when the user was using Dock to quit our application. Now, this is not the case and QEvent::Quit is used instead. However, the same QEvent::Quit is used when my code calls qApp->quit somewhere. Is it possible to distinguish these two situations? ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest
Re: [Interest] QEvent::Quit vs. QEvent::Close
Indeed, you are right. I missed that QCoreApplicationPrivate::quit is virtual and overridden in QGuiApplicationPrivate to go through the QPA layer, which then looks for Qt like any other spontanous event. Created https://bugreports.qt.io/browse/QTBUG-118533 Not a high priority, as you can know when you call QApplication::quit() yourself, I suppose. Volker > On 24 Oct 2023, at 20:30, Alexander Dyagilev wrote: > > Hello, > > No, it returns true always. > > On 10/23/2023 11:30 PM, Hamish Moffatt via Interest wrote: >> On 24/10/23 06:10, Alexander Dyagilev wrote: >>> I would prefer for an additional event to be used when the user triggers >>> Quit. E.g. something like QEvent::QuitByUser. >>> >>> For now, it seems I will have to involve some additional ugly logics >>> (something like setting a global variable) More code more complexity >>> for such a simple situation. Not good, IMO. >> >> >> Does QEvent::spontaneous() tell you anything about the two different quit >> events? >> >> Hamish >> >> ___ >> Interest mailing list >> Interest@qt-project.org >> https://lists.qt-project.org/listinfo/interest > ___ > Interest mailing list > Interest@qt-project.org > https://lists.qt-project.org/listinfo/interest ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest
Re: [Interest] QEvent::Quit vs. QEvent::Close
Then, it means it's a bug, because it's set always. At least in Qt 6.4.2. On 10/24/2023 12:15 AM, Volker Hilsheimer via Interest wrote: They should; the window system event is handled as a spontaneous event and should reach Q(Gui)Application::event with the spontaneous flag set; a call to Q(Core)Application::quit sends (or posts, depending on the thread) the event as a synthetic event to the qApp instance, so the spontaneous flag will not be set. Volker ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest
Re: [Interest] QEvent::Quit vs. QEvent::Close
Hello, No, it returns true always. On 10/23/2023 11:30 PM, Hamish Moffatt via Interest wrote: On 24/10/23 06:10, Alexander Dyagilev wrote: I would prefer for an additional event to be used when the user triggers Quit. E.g. something like QEvent::QuitByUser. For now, it seems I will have to involve some additional ugly logics (something like setting a global variable) More code more complexity for such a simple situation. Not good, IMO. Does QEvent::spontaneous() tell you anything about the two different quit events? Hamish ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest
Re: [Interest] QEvent::Quit vs. QEvent::Close
> On 23 Oct 2023, at 22:30, Hamish Moffatt via Interest > wrote: > > On 24/10/23 06:10, Alexander Dyagilev wrote: >> I would prefer for an additional event to be used when the user triggers >> Quit. E.g. something like QEvent::QuitByUser. >> >> For now, it seems I will have to involve some additional ugly logics >> (something like setting a global variable) More code more complexity for >> such a simple situation. Not good, IMO. > > > Does QEvent::spontaneous() tell you anything about the two different quit > events? > > Hamish They should; the window system event is handled as a spontaneous event and should reach Q(Gui)Application::event with the spontaneous flag set; a call to Q(Core)Application::quit sends (or posts, depending on the thread) the event as a synthetic event to the qApp instance, so the spontaneous flag will not be set. Volker ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest
Re: [Interest] QEvent::Quit vs. QEvent::Close
On 24/10/23 06:10, Alexander Dyagilev wrote: I would prefer for an additional event to be used when the user triggers Quit. E.g. something like QEvent::QuitByUser. For now, it seems I will have to involve some additional ugly logics (something like setting a global variable) More code more complexity for such a simple situation. Not good, IMO. Does QEvent::spontaneous() tell you anything about the two different quit events? Hamish ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest
Re: [Interest] QEvent::Quit vs. QEvent::Close
I would prefer for an additional event to be used when the user triggers Quit. E.g. something like QEvent::QuitByUser. For now, it seems I will have to involve some additional ugly logics (something like setting a global variable) More code more complexity for such a simple situation. Not good, IMO. On 10/23/2023 10:05 PM, Alexander Dyagilev wrote: Hello, In Qt 5.x we had QEvent::Close when the user was using Dock to quit our application. Now, this is not the case and QEvent::Quit is used instead. However, the same QEvent::Quit is used when my code calls qApp->quit somewhere. Is it possible to distinguish these two situations? ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest
[Interest] QEvent::Quit vs. QEvent::Close
Hello, In Qt 5.x we had QEvent::Close when the user was using Dock to quit our application. Now, this is not the case and QEvent::Quit is used instead. However, the same QEvent::Quit is used when my code calls qApp->quit somewhere. Is it possible to distinguish these two situations? ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest