[Interest] QEvent::Quit vs. QEvent::Close

Volker Hilsheimer volker.hilsheimer at qt.io
Mon Oct 23 23:15:07 CEST 2023


> On 23 Oct 2023, at 22:30, Hamish Moffatt via Interest <interest at qt-project.org> 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



More information about the Interest mailing list