Re: Disabling the cancel button

Balatoni Denes <[email protected]> Fri, 29 Nov 2002 00:13:09 +0100
Newsgroups gmane.comp.handhelds.zaurus.devel
Message-ID <[email protected]>
Hi!

I have found that if you reimplement keypressevent slot(?) and in that
you ev->ignore the events you are not interested in (eg cancel button), this 
will do what you want. Maybe it is not supposed to do that ? It does that for 
me anyway.

bye
Denes

On 2002. november 28. 23:38, Eggert Ehmke wrote:
> On Thursday 28 November 2002 23:21, Konrad Hinsen wrote:
> > I find it quite annoying that my freshly written Qt application is
> > terminated whenever the "cancel" button is pressed. Can I deactivate
> > this somehow?
>
> Overwrite the closeEvent in your application class (QMainWindow derived):
>
> /** Make sure the user really wants to quit
>   */
> void xxxApp::closeEvent (QCloseEvent* evt)
> {
>   if (QMessageBox::warning (this, tr("xxx will be terminated"), tr("Are you
> sure?"),
>       QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
>     evt->accept();
>   else
>     evt->ignore();
> }
>
> Hope this helps ...
> Eggert



-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T 
handheld. Power & Color in a compact size! 
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en