Warning, /frameworks/kirigami/tests/KeyboardTest.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * SPDX-FileCopyrightText: 2016 Aleix Pol Gonzalez <aleixpol@kde.org>
0003 *
0004 * SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006
0007 import QtQuick
0008 import QtQuick.Controls
0009
0010 import org.kde.kirigami as Kirigami
0011
0012 Kirigami.ApplicationWindow {
0013 id: main
0014
0015 Component {
0016 id: keyPage
0017 Kirigami.Page {
0018 id: page
0019
0020 // Don't remove, used in autotests
0021 readonly property alias lastKey: see.text
0022
0023 Label {
0024 id: see
0025 anchors.centerIn: parent
0026 color: page.activeFocus ? Kirigami.Theme.focusColor : Kirigami.Theme.textColor
0027 }
0028
0029 Keys.onPressed: event => {
0030 if (event.text) {
0031 see.text = event.text
0032 } else {
0033 see.text = event.key
0034 }
0035 }
0036
0037 Keys.onEnterPressed: main.showPassiveNotification("page!")
0038 }
0039 }
0040
0041 header: Label {
0042 padding: Kirigami.Units.largeSpacing
0043 text: `focus: ${main.activeFocusItem}, current: ${main.pageStack.currentIndex}`
0044 }
0045
0046 Component.onCompleted: {
0047 main.pageStack.push(keyPage)
0048 main.pageStack.push(keyPage)
0049 }
0050 }