RE: Disabling the cancel button
"Russell Clarke" <[email protected]> Mon, 2 Dec 2002 11:44:21 -0000
| Newsgroups | gmane.comp.handhelds.zaurus.devel |
|---|---|
| Message-ID | <[email protected]> |
> > you can get round this by reimplementing QApplication::notify() and
> > filtering off the cancel key event there.
>
> Unfortunately that doesn't work for me. My notify() routine only sees
> a close event when cancel is pressed.
the code you quote below is from qwsEventFilter, which is called by
notify(). Are you sure you have overridden notify() correctly? it's a
public virtual member, so there should not be a problem.
Perhaps you are handling the wrong event? You should be looking for a
KeyPress event, and check if ((QKeyEvent*)event)->key() == Qt::Key_Escape,
otherwise call the base class function as normal.
> I looked at the source of QPEApplication, but that hasn't helped. Except
> for understanding how the console application acquires its special status:
>
> if ( active && active->testWFlags( WType_TopLevel ) &&
> (int)active->winId() == ke->simpleData.window &&
> !active->testWFlags(
> WStyle_Dialog|WStyle_Customize|WType_Popup|WType_Desktop )) {
> if ( active->inherits( "QDialog" ) ) {
> HackDialog *d = (HackDialog *)active;
> d->rejectIt();
> return TRUE;
> } else if ( strcmp( argv()[0], "embeddedkonsole") != 0 ) {
> active->close();
> }
> }
>
> This code is from QPEApplication - it contains an explicit exception
> for the application called "embeddedkonsole"! What a hack...
> Does anyone know what the "testWFlags" stuff is for? Could I perhaps
> set some flag somewhere in order to get around this forced termination?
see http://doc.trolltech.com/2.3/qwidget.html#70dec1 and
http://doc.trolltech.com/2.3/qt.html#WidgetFlags. the short answer: no.
PS I should also recommend the qt interest mailing list
(http://lists.trolltech.com/qt-interest/), which is a lot more active than
this one...
hope that helps
--
Russell Clarke
Picsel Technologies Ltd
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf