Re: Disabling the cancel button

Konrad Hinsen <[email protected]> 29 Nov 2002 22:42:41 +0100
Newsgroups gmane.comp.handhelds.zaurus.devel
Message-ID <[email protected]>
"Russell Clarke" <[email protected]> writes:

> QPEApplication reimplements QApplication::qwsEventFilter() - this is where
> the key event for Qt::Key_Escape is trapped and hardwired to
> QWidget::close().  The key event will still be delivered, by a different
> route, but only after this has happened.
> 
> 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.

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?

Konrad.



-------------------------------------------------------
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