forked from slint-ui/slint
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcrud.slint
82 lines (67 loc) · 2.07 KB
/
crud.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright © SixtyFPS GmbH <[email protected]>
// SPDX-License-Identifier: MIT
import { LineEdit, Button, Slider, StandardListView, GridBox, HorizontalBox } from "std-widgets.slint";
export component MainWindow inherits Window {
in property <[StandardListViewItem]> names-list;
out property <int> current-item: list.current-item;
out property <string> name;
out property <string> surname;
out property <string> prefix;
callback prefixEdited();
callback createClicked();
callback updateClicked();
callback deleteClicked();
GridBox {
Text {
text: "Filter prefix:";
vertical-alignment: center;
horizontal-alignment: right;
}
LineEdit {
text <=> root.prefix;
edited => { root.prefixEdited() }
}
list := StandardListView {
row: 1;
rowspan: 3;
colspan: 2;
model: root.names-list;
}
Text {
col: 2;
row: 1;
text: "Name: ";
vertical-alignment: center;
horizontal-alignment: right;
}
LineEdit { text <=> root.name; }
Text {
col: 2;
row: 2;
text: "Surname: ";
vertical-alignment: center;
horizontal-alignment: right;
}
LineEdit { text <=> root.surname; }
HorizontalBox {
padding-left: 0;
padding-bottom: 0;
row: 4;
alignment: start;
Button {
clicked => { root.createClicked() }
text: "Create";
}
Button {
clicked => { root.updateClicked() }
text: "Update";
enabled: list.current-item != -1 && list.current-item < root.names-list.length;
}
Button {
clicked => { root.deleteClicked() }
text: "Delete";
enabled: list.current-item != -1 && list.current-item < root.names-list.length;
}
}
}
}