mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
Change C++ API to use the ComponentHandle
This commit is contained in:
parent
8f362ead43
commit
d6a440aa4a
65 changed files with 222 additions and 141 deletions
|
@ -11,7 +11,7 @@ LICENSE END */
|
|||
|
||||
int main()
|
||||
{
|
||||
static MainWindow demo;
|
||||
auto demo = MainWindow::create();
|
||||
|
||||
auto todo_model = std::make_shared<sixtyfps::VectorModel<TodoItem>>(std::vector {
|
||||
TodoItem { true, "Implement the .60 file" },
|
||||
|
@ -23,13 +23,13 @@ int main()
|
|||
TodoItem { false, "???" },
|
||||
TodoItem { false, "Profit" }
|
||||
});
|
||||
demo.set_todo_model(todo_model);
|
||||
demo->set_todo_model(todo_model);
|
||||
|
||||
demo.on_todo_added([todo_model](const sixtyfps::SharedString &s) {
|
||||
demo->on_todo_added([todo_model](const sixtyfps::SharedString &s) {
|
||||
todo_model->push_back(TodoItem { false, s });
|
||||
});
|
||||
|
||||
demo.on_remove_done([todo_model] {
|
||||
demo->on_remove_done([todo_model] {
|
||||
int offset = 0;
|
||||
int count = todo_model->row_count();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
|
@ -40,5 +40,5 @@ int main()
|
|||
}
|
||||
});
|
||||
|
||||
demo.run();
|
||||
demo->run();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue