summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2014-04-22 08:51:40 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-22 13:54:42 +0200
commitc97edb25796487c719376dd73c365603bcd68782 (patch)
tree73875c712cee968ad5df6c9aa17fd53e60be12aa
parent878da15f2cfadf249a355b33d31f7937078ea174 (diff)
WinRT: Handle back button as press or release
Earlier, only the back press was checked for acceptance. By also checking the release event, this makes the backstepping behavior consistent with Qt for Android, and fixes the expected behavior found in our demo applications. Task-number: QTBUG-35951 Change-Id: I9c2f18816b838d57713ba4dd3624e2f3f1ac40ac Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com> Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp
index 2e38f81499..583441f396 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.cpp
+++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp
@@ -1020,7 +1020,9 @@ HRESULT QWinRTScreen::onOrientationChanged(IInspectable *)
HRESULT QWinRTScreen::onBackButtonPressed(IInspectable *, IBackPressedEventArgs *args)
{
QKeyEvent backPress(QEvent::KeyPress, Qt::Key_Back, Qt::NoModifier);
+ QKeyEvent backRelease(QEvent::KeyRelease, Qt::Key_Back, Qt::NoModifier);
backPress.setAccepted(false);
+ backRelease.setAccepted(false);
QObject *receiver = m_visibleWindows.isEmpty()
? static_cast<QObject *>(QGuiApplication::instance())
@@ -1028,12 +1030,8 @@ HRESULT QWinRTScreen::onBackButtonPressed(IInspectable *, IBackPressedEventArgs
// If the event is ignored, the app will suspend
QGuiApplication::sendEvent(receiver, &backPress);
- if (backPress.isAccepted()) {
- args->put_Handled(true);
- // If the app accepts the event, send the release for symmetry
- QKeyEvent backRelease(QEvent::KeyRelease, Qt::Key_Back, Qt::NoModifier);
- QGuiApplication::sendEvent(receiver, &backRelease);
- }
+ QGuiApplication::sendEvent(receiver, &backRelease);
+ args->put_Handled(backPress.isAccepted() || backRelease.isAccepted());
return S_OK;
}