mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-28 06:14:10 +00:00
53 lines
No EOL
1.4 KiB
Text
53 lines
No EOL
1.4 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// 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;
|
|
}
|
|
}
|
|
} |