| 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 component MyMenu inherits MenuBar { |
| 6 | // ^error{MenuBar can only be within a Window element} |
| 7 | } |
| 8 | |
| 9 | export component A inherits Window { |
| 10 | mb := MenuBar { |
| 11 | Rectangle {} |
| 12 | // ^error{Rectangle is not allowed within MenuBar. Only Menu are valid children} |
| 13 | x: 45px; |
| 14 | // ^error{Unknown property x in MenuBar} |
| 15 | width: 45px; |
| 16 | // ^error{Unknown property width in MenuBar} |
| 17 | entries: []; |
| 18 | // ^error{Unknown property entries in MenuBar} |
| 19 | init => {} |
| 20 | // ^error{'init' is not a callback in MenuBar} |
| 21 | |
| 22 | Menu { |
| 23 | title: "hello" ; |
| 24 | x: 0px; |
| 25 | // ^error{Unknown property x in Menu} |
| 26 | max-height: 13px; |
| 27 | // ^error{Unknown property max-height in Menu} |
| 28 | opacity: 0.4; |
| 29 | // ^error{Unknown property opacity in Menu} |
| 30 | Rectangle { |
| 31 | // ^error{Rectangle is not allowed within Menu. Only Menu MenuItem MenuSeparator are valid children} |
| 32 | } |
| 33 | |
| 34 | MenuItem { |
| 35 | activated => { |
| 36 | mb.activated({}); |
| 37 | // ^error{Element 'MenuBar' does not have a property 'activated'} |
| 38 | } |
| 39 | |
| 40 | TouchArea {} |
| 41 | // ^error{MenuItem cannot have children elements} |
| 42 | } |
| 43 | |
| 44 | } |
| 45 | |
| 46 | MenuItem {} |
| 47 | // ^error{MenuItem is not allowed within MenuBar. Only Menu are valid children} |
| 48 | |
| 49 | MenuSeparator {} |
| 50 | // ^error{MenuSeparator is not allowed within MenuBar. Only Menu are valid children} |
| 51 | } |
| 52 | |
| 53 | Rectangle { |
| 54 | x: 45px; |
| 55 | MenuBar { |
| 56 | // ^error{MenuBar can only be within a Window element} |
| 57 | } |
| 58 | |
| 59 | MenuItem { |
| 60 | // ^error{Unknown element 'MenuItem'} |
| 61 | Menu {} |
| 62 | // ^error{Menu can only be within a ContextMenuArea element} |
| 63 | } |
| 64 | |
| 65 | Menu {} |
| 66 | // ^error{Menu can only be within a ContextMenuArea element} |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | |
| 71 | |