Re: Disabling the cancel button
Eggert Ehmke <[email protected]> Thu, 28 Nov 2002 23:38:43 +0100
| Newsgroups | gmane.comp.handhelds.zaurus.devel |
|---|---|
| Message-ID | <[email protected]> |
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
--
Eggert Ehmke
Schuckertplatz 8
13629 Berlin
mailto:[email protected]
Phone: 030-382 6093
Mobile: +49 173-917 8254
-------------------------------------------------------
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