Review Request: Send a Qt::Key_Back key on the back button instead of the Qt::Key_Close key.

Micke Prag micke.prag at telldus.se
Thu Jan 10 18:39:36 UTC 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/108332/
-----------------------------------------------------------

Review request for Necessitas.


Description
-------

Send a Qt::Key_Back key on the back button instead of the Qt::Key_Close key.
    
This makes it much easier to control the behavior of the back button.
For example this code can be used in a QML application to implement back button control.

Item {
    focus: true
    Keys.onBackPressed: {
        if (shouldHandleBackButton()) {
            doHandleBackButton()
        } else {
            // Close the application, default behaviour
            event.accepted = false
        }
    }
}

Basically it emits a Key_Close key event on the back button. If no one accepts it the current top level widget gets the close event as before. This can also be implemented in a non QML application in a similar way by subclassing QWidget::keyPressEvent() and calling QEvent::accept() on the event.


Diffs
-----

  src/android/jar/src/org/kde/necessitas/industrius/QtActivityDelegate.java 650081c 
  src/gui/kernel/qwidget.cpp d67c388 
  src/plugins/platforms/android/src/androidjnimain.cpp 5ee30c6 

Diff: http://git.reviewboard.kde.org/r/108332/diff/


Testing
-------

Tested on Cube U30GT


Thanks,

Micke Prag

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/necessitas-devel/attachments/20130110/36797175/attachment.html>


More information about the Necessitas-devel mailing list