mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-30 15:17:25 +00:00
C++: sort the member of a struct in the same order as in the .slint file
This commit is contained in:
parent
2e1ce47b79
commit
cdaf2abb47
5 changed files with 31 additions and 22 deletions
|
@ -8,15 +8,19 @@ int main()
|
|||
auto demo = MainWindow::create();
|
||||
|
||||
auto todo_model = std::make_shared<slint::VectorModel<TodoItem>>(std::vector {
|
||||
TodoItem { true, "Implement the .slint file" }, TodoItem { false, "Do the Rust part" },
|
||||
TodoItem { true, "Make the C++ code" },
|
||||
TodoItem { false, "Write some JavaScript code" },
|
||||
TodoItem { false, "Test the application" }, TodoItem { false, "Ship to customer" },
|
||||
TodoItem { false, "???" }, TodoItem { false, "Profit" } });
|
||||
TodoItem { "Implement the .slint file", true },
|
||||
TodoItem { "Do the Rust part", false },
|
||||
TodoItem { "Make the C++ code", true },
|
||||
TodoItem { "Write some JavaScript code", false },
|
||||
TodoItem { "Test the application", false },
|
||||
TodoItem { "Ship to customer", false },
|
||||
TodoItem { "???", false },
|
||||
TodoItem { "Profit", false },
|
||||
});
|
||||
demo->set_todo_model(todo_model);
|
||||
|
||||
demo->on_todo_added([todo_model](const slint::SharedString &s) {
|
||||
todo_model->push_back(TodoItem { false, s });
|
||||
todo_model->push_back(TodoItem { s, false });
|
||||
});
|
||||
|
||||
demo->on_remove_done([todo_model] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue