Add sample qml application
[staging/HomeScreen.git] / sample-qml / imports / system / App.qml.org
1 /* Copyright (C) 2015, Jaguar Land Rover. All Rights Reserved.
2  *
3  * This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6  
7 import QtQuick 2.0
8 import system 1.0
9
10 FocusScope {
11     id: root
12     property string appId
13     anchors.fill: parent
14     visible: System.activeApp === appId
15     property bool hasKeyFocus: false
16     focus: visible
17     onFocusChanged: if (focus) hasKeyFocus = true
18
19     Keys.onPressed: {
20         switch (event.key) {
21         case Qt.Key_Left:
22         case Qt.Key_Right:
23             root.hasKeyFocus = false
24             break
25         default:
26             break
27         }
28     }
29 }