| 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 | import { ListView } from "std-widgets.slint" ; |
| 5 | |
| 6 | component ShowResult inherits Rectangle { |
| 7 | width: 50%; |
| 8 | height: 100%; |
| 9 | |
| 10 | VerticalLayout { |
| 11 | ListView { |
| 12 | for file[idx] in [1,2,3]:Rectangle { |
| 13 | height: 20px; |
| 14 | // width: parent.width; // change to this line compiles fine |
| 15 | width: 100%; // An error occurred!!! |
| 16 | } |
| 17 | } |
| 18 | } |
| 19 | } |
| 20 | export component TestCase inherits Window { |
| 21 | width: 300px; |
| 22 | height: 326px; |
| 23 | |
| 24 | HorizontalLayout { |
| 25 | width: 100%; |
| 26 | height: 100%; |
| 27 | |
| 28 | ShowResult {} |
| 29 | } |
| 30 | |
| 31 | |
| 32 | fli := Flickable { |
| 33 | viewport-height: 1000px; |
| 34 | viewport-width: 2000px; |
| 35 | rec := Rectangle { |
| 36 | width: 100%; |
| 37 | height: parent.height; |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | out property <bool> test: |
| 42 | rec.width == 300px && |
| 43 | rec.height == 326px; |
| 44 | } |
| 45 | |
| 46 | /* |
| 47 | |
| 48 | ```cpp |
| 49 | auto handle = TestCase::create(); |
| 50 | const TestCase &instance = *handle; |
| 51 | assert(instance.get_test()); |
| 52 | ``` |
| 53 | |
| 54 | ```rust |
| 55 | let instance = TestCase::new().unwrap(); |
| 56 | assert!(instance.get_test()); |
| 57 | ``` |
| 58 | |
| 59 | */ |
| 60 | |