[Qt-interest] Quit vs. Close window

Tiago Correia tiago at cnotinfor.pt
Tue Dec 30 02:50:26 CET 2008


Hi,

Maybe you should create the QMainWindow without the flag WA_DeleteOnClose.
In this case the application doesn't finish when you close the window, but
still the event gets called by you close the window.
But do you have multiple windows on your applications?

On Tue, Dec 30, 2008 at 12:18 AM, Israel Brewster <israel at frontierflying.com
> wrote:

> On Dec 29, 2008, at 2:31 PM, Deepak Chandran wrote:
>
> I did this by overwriting the closeEvent in QMainWindow
>
>
> Thanks for the response. Unfortunately, as I mentioned in my
> second sentence, I have already tried that. To reiterate, the problem with
> that approach is that the closeEvent is called when the window is closed due
> to application exit as well as when the user closes the window. I don't want
> the routines in question to run on application exit - only on window close.
>
> -----------------------------------------------
> Israel Brewster
> Computer Support Technician
> Frontier Flying Service Inc.
> 5245 Airport Industrial Rd
> Fairbanks, AK 99709
> (907) 450-7250 x293
> -----------------------------------------------
>
>
>
> On Mon, Dec 29, 2008 at 3:06 PM, Israel Brewster <
> israel at frontierflying.com> wrote:
>
>> How can I handle a close window command (such as when the user clicks
>> the close button) differently than a quit (or exit, if you prefer)
>> command? I have made a custom implementation of the closeEvent()
>> function to do some stuff when the user closes the window, and this
>> works. However, this is also called when you choose to quit the
>> application, which I don't want to happen- I only want the function to
>> run when the user manually closes the window. How can I implement
>> this? is there some sort of flag I can look for that lets me know the
>> application is closing? Or a specific signal that is emitted when the
>> close button is pressed that is not emitted when the application
>> exits? Thanks.
>>
>> -----------------------------------------------
>> Israel Brewster
>> Computer Support Technician
>> Frontier Flying Service Inc.
>> 5245 Airport Industrial Rd
>> Fairbanks, AK 99709
>> (907) 450-7250 x293
>> -----------------------------------------------
>>
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>


-- 
Tiago Correia
chief technology officer

cnoti inovação & desenvolvimento – Aprendizagem enRiquecida pela Tecnologia
www.cnotinfor.pt
Telefone: +351 239 499 231

Subscreva gratuitamente a nossa Newsletter BICA – Boletim informativo de
Interactividade, Comunicação e Aprendizagem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20081230/f591fbfd/attachment.html 


More information about the Qt-interest-old mailing list