| 1 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
| 2 | // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 |
| 3 | |
| 4 | |
| 5 | export Demo := Window { |
| 6 | width: 300px; |
| 7 | height: 300px; |
| 8 | property <bool> toggle; |
| 9 | t:= Text { |
| 10 | text: "Hello World" ; |
| 11 | font-size: 24px; |
| 12 | y <=> x; |
| 13 | } |
| 14 | |
| 15 | property <string> some_prop <=> t.text; |
| 16 | |
| 17 | states [ |
| 18 | Hello when toggle: { |
| 19 | t.y: 100px; |
| 20 | // ^error{Cannot change the property 'y' in a state because it is initialized with a two-way binding} |
| 21 | some_prop: "plop" ; |
| 22 | // ^error{Cannot change the property 'some-prop' in a state because it is initialized with a two-way binding} |
| 23 | } |
| 24 | ] |
| 25 | } |
| 26 | |