mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Add support for invoking an init callback on component and element construction
This enables imperative code to be run. To be used sparingly :-)
This commit is contained in:
parent
9baf6f2bde
commit
907b58161c
20 changed files with 366 additions and 46 deletions
14
internal/compiler/tests/syntax/callbacks/init.slint
Normal file
14
internal/compiler/tests/syntax/callbacks/init.slint
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
global Singleton := {
|
||||
callback init;
|
||||
// ^error{A global component cannot have an 'init' callback}
|
||||
init => { debug("nope"); }
|
||||
// ^error{A global component cannot have an 'init' callback}
|
||||
}
|
||||
|
||||
Test := Rectangle {
|
||||
callback init;
|
||||
// ^error{Cannot override callback 'init'}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue