Hi,

I have the following event filter to filter the default back button Action on a 
Android app. I’m attaching this filter to the app QWindow.

It works, but not all the times! I was wondering why. Does anyone had the need 
to do something similar and can tell me why it is not working flawless all the 
time? 

I need to filter the default back button action in order to avoid the app 
crash. 
 
bool eventFilter(QObject *obj, QEvent *event)
{

    if (event->type()==QEvent::KeyPress)
    {
        QKeyEvent* key = static_cast<QKeyEvent*>(event);

        if (key->key()==Qt::Key_Back)
        {
            //qDebug() << "ignore default back button action on Android";
            event->accept();

            return true;
        }
    }

    return QObject::eventFilter(obj, event);
}

Nuno

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to