1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
3
4W := Window {
5 VerticalLayout {
6 Rectangle { background: field.has_focus ? blue: red; }
7 field := FocusScope {
8 vertical_stretch: 1;
9 key-pressed(event) => {
10 if (event.text == Key.F1) {
11 debug("F1");
12 }
13 if (event.text == Key.PageUp) {
14 debug("PageUp");
15 }
16 if (event.modifiers.control) {
17 debug(" (control modifier pressed)");
18 }
19 if (event.modifiers.alt) {
20 debug(" (alt modifier pressed)");
21 }
22 if (event.modifiers.shift) {
23 debug(" (shift modifier pressed)");
24 }
25 if (event.modifiers.meta) {
26 debug(" (meta modifier pressed)");
27 }
28 debug(event.text);
29 t.text += event.text;
30 accept
31 }
32 Rectangle { background: yellow; }
33 }
34 t:= Text {
35 text: "> ";
36 }
37 }
38}
39