slint/examples/7guis/crud.slint
Florian Blasius 520df46998
Update examples to new syntax (#2067)
* run slint-updater on examples
* manual syntax updates
2023-01-16 12:11:25 +00:00

78 lines
2.1 KiB
Text

// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
import { LineEdit, Button, Slider, StandardListView, GridBox, HorizontalBox } from "std-widgets.slint";
component MainWindow inherits Window {
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 {
text: "Create";
clicked => { root.createClicked() }
}
Button {
text: "Update";
enabled: list.current-item != -1 && list.current-item < root.names-list.length;
clicked => { root.updateClicked() }
}
Button {
text: "Delete";
enabled: list.current-item != -1 && list.current-item < root.names-list.length;
clicked => { root.deleteClicked() }
}
}
}
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();
}