[Qt-interest] Ctrl-C exit of qapp
Brad Hards
bradh at frogmouth.net
Sun Sep 26 08:35:08 CEST 2010
On Sunday, September 26, 2010 03:07:02 pm emmanuel_mayssat at lynceantech.com
wrote:
> I am trying to catch the Ctrl-C exception to close the qapplication I am
> running. How do i do that?
>
> try:
> qapp.exec_()
> except KeyboardInterupt as e:
> ...
> doesn't work!
Most of Qt doesn't use exceptions, so this approach is almost always not what
you wanted.
> Please help,
It would have been easier if you'd said what you are trying to accomplish
(rather than how), but you probably want to connect to the aboutToQuit()
signal. See http://doc.trolltech.com/latest/qcoreapplication.html#aboutToQuit
Brad
More information about the Qt-interest-old
mailing list