summaryrefslogtreecommitdiff
path: root/src/controls
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@digia.com>2014-10-01 13:41:37 +0200
committerMitch Curtis <mitch.curtis@digia.com>2014-10-02 07:48:52 +0200
commit85f57be3a096cc4f580f30e0eb59de3747f3da03 (patch)
tree11cf282e72732cdac65cc0e61ac941725fe38c86 /src/controls
parent4d851e14ebf0ec9bbfd899e71fe95c18ea1e658d (diff)
downloadqtquickcontrols-85f57be3a096cc4f580f30e0eb59de3747f3da03.tar.gz
ApplicationWindow: top level items must get focus when they ask for it.
Currently, the following Item will not receive any key events: import QtQuick 2.2 import QtQuick.Controls 1.2 ApplicationWindow { visible: true width: 200 height: 200 Item { focus: true anchors.fill: parent Keys.onLeftPressed: textItem.text = "Left" Keys.onRightPressed: textItem.text = "Right" Keys.onPressed: { if (event.key === Qt.Key_Home) { textItem.text = "Home"; } else if (event.key === Qt.Key_End) { textItem.text = "End"; } } Text { id: textItem anchors.centerIn: parent } } } Using Window instead of ApplicationWindow does, however. ApplicationWindow can behave the same if we ensure that the panel has focus set to true. When the panel has focus, the contentItem can receive focus. [ChangeLog][ApplicationWindow] Top level items now receive focus when their focus property is set to true, in the same way that top level items of Window do. Change-Id: I16ef1632fc6df1989015e62e8683b6cd7c5be8a6 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Liang Qi <liang.qi@digia.com>
Diffstat (limited to 'src/controls')
-rw-r--r--src/controls/ApplicationWindow.qml1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/controls/ApplicationWindow.qml b/src/controls/ApplicationWindow.qml
index 2ddff113..d57ca598 100644
--- a/src/controls/ApplicationWindow.qml
+++ b/src/controls/ApplicationWindow.qml
@@ -208,6 +208,7 @@ Window {
anchors.fill: parent
sourceComponent: __style ? __style.panel : null
onStatusChanged: if (status === Loader.Error) console.error("Failed to load Style for", root)
+ focus: true
Loader {
id: styleLoader
sourceComponent: style