Important: Please read the Qt Code of Conduct -

Event for QWidget after "back" pressed in Android

  • I am little weird: if focus is on some QWidget and user presses system "back" button - then will this widget receive any event or signal? Which one?

    If this happiness with QMainWindow - it receives close event. What about QWidget?

  • Moderators

    Hi @Gourmet
    I think that is the default behavior for everything. Exception may be stuff like QLineEdit that has an active focus and accepts keyPressEvents.

    You can either override the keyPressEvent of your top most widget/ or install an event filter on that.

    The key you'll have to listen to is the Qt::Key_Back key.

Log in to reply