forked from slint-ui/slint
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main_window.slint
53 lines (40 loc) · 1.4 KB
/
main_window.slint
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright © SixtyFPS GmbH <[email protected]>
// SPDX-License-Identifier: MIT
import { LineEdit, Button } from "std-widgets.slint";
import { VirtualKeyboardHandler, VirtualKeyboard, KeyModel } from "virtual_keyboard.slint";
export { VirtualKeyboardHandler, KeyModel }
export component MainWindow inherits Window {
title: "Virtual Keyboard example";
width: 600px;
height: 400px;
Rectangle {
VerticalLayout {
alignment: start;
padding: 16px;
spacing: 8px;
Text {
text: "Focus to open keyboard";
horizontal-alignment: left;
}
LineEdit {}
Text {
text: "Focus to open keyboard";
horizontal-alignment: left;
}
LineEdit {}
HorizontalLayout {
alignment: start;
Button {
text: self.checked ? "Click to close keyboard" : "Click to open keyboard";
checked: TextInputInterface.text-input-focused;
clicked => {
TextInputInterface.text-input-focused = !TextInputInterface.text-input-focused;
}
}
}
}
keyboard := VirtualKeyboard {
y: TextInputInterface.text-input-focused ? parent.height - self.height : parent.height;
}
}
}