mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 01:33:19 +00:00
Switch from Qt6 to Slint
This commit is contained in:
parent
f8be14bcf8
commit
63bf267a22
107 changed files with 27532 additions and 2896 deletions
27
lib/slint-vynui/DatePicker.slint
Normal file
27
lib/slint-vynui/DatePicker.slint
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { Button, DatePickerPopup, Date, Palette } from "std-widgets.slint";
|
||||
import { VLabeledComponent } from "LabeledComponent.slint";
|
||||
import { VButton } from "Button.slint";
|
||||
|
||||
|
||||
|
||||
export component VDatePicker inherits VLabeledComponent {
|
||||
in-out property<Date> date;
|
||||
in-out property<string> dateDisplay: formatZeroPadding(date.day) + "/" + formatZeroPadding(date.month) + "/" + date.year;
|
||||
|
||||
pure function formatZeroPadding(number: int) -> string {
|
||||
if (number < 10) {
|
||||
return "0\{number}";
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
button := VButton {
|
||||
text: dateDisplay;
|
||||
enabled: root.enabled;
|
||||
clicked => { taskDateInput.show() }
|
||||
}
|
||||
|
||||
taskDateInput := DatePickerPopup {
|
||||
accepted(date) => { root.date = date }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue