| 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 | export global MyGlobal { |
| 5 | in-out property <bool> foo: false; |
| 6 | in-out property <bool> foo2; |
| 7 | } |
| 8 | |
| 9 | export component TestCase inherits Window { |
| 10 | width: 600px; |
| 11 | height: 400px; |
| 12 | |
| 13 | in-out property <bool> test: MyGlobal.foo == false && MyGlobal.foo2 == false; |
| 14 | |
| 15 | r := Rectangle { |
| 16 | // This two-way binding causes MyGlobal.foo to be true |
| 17 | visible <=> MyGlobal.foo; |
| 18 | } |
| 19 | |
| 20 | r2 := Rectangle { |
| 21 | // This two-way binding causes MyGlobal.foo to be true |
| 22 | visible <=> MyGlobal.foo2; |
| 23 | } |
| 24 | |
| 25 | } |
| 26 | |
| 27 | /* |
| 28 | |
| 29 | ```rust |
| 30 | let instance = TestCase::new().unwrap(); |
| 31 | assert_eq!(instance.get_test(), true); |
| 32 | ``` |
| 33 | |
| 34 | ```cpp |
| 35 | auto handle = TestCase::create(); |
| 36 | const TestCase &instance = *handle; |
| 37 | assert_eq(instance.get_test(), true); |
| 38 | ``` |
| 39 | |
| 40 | */ |