mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 05:44:52 +00:00
C++: add on_* funciton to connect to signals
This commit is contained in:
parent
a4efac920a
commit
b2a1a72450
2 changed files with 24 additions and 9 deletions
|
@ -5,16 +5,14 @@ int main()
|
|||
{
|
||||
static Hello component;
|
||||
|
||||
component.foobar.set_handler([](auto...) { std::cout << "Hello from C++" << std::endl; });
|
||||
component.on_foobar([](auto...) { std::cout << "Hello from C++" << std::endl; });
|
||||
|
||||
component.plus_clicked.set_handler([]() {
|
||||
auto &counter = component.counter;
|
||||
counter.set(counter.get() + 1);
|
||||
component.on_plus_clicked([]() {
|
||||
component.set_counter(component.get_counter() + 1);
|
||||
});
|
||||
|
||||
component.minus_clicked.set_handler([]() {
|
||||
auto &counter = component.counter;
|
||||
counter.set(counter.get() - 1);
|
||||
component.on_minus_clicked([]() {
|
||||
component.set_counter(component.get_counter() - 1);
|
||||
});
|
||||
|
||||
sixtyfps::ComponentWindow window;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue