mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-21 15:52:19 +00:00

Consider ```slint // Some code in the wild actually have made their own menubar before component MenuBar { /* ... */ } component Row { /* ... */ } export component Main inherits Window { // This should find the declared component and not the builtin component MenuBar { } GridLayout { Row {} } } ``` Previously, `MenuBar` and `Row` were first resolved against `additional_accepted_child_types` and so it would always find the builtin one. But this patch changes that to find the builtin one only if it hasn't been replaced by another component with the name name. (So we'd use the cusom MenuBar and the custom Row) Another change is that we also lookup the additional_accepted_child_types if they are in a @children. ```slint component MyGrid { GridLayout { @children } } export component Main { MyGrid { // This used to be an error but is now accepted Row { } } } ```
18 lines
452 B
Text
18 lines
452 B
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
|
|
|
export component MenuBar {
|
|
in property <int> foobar;
|
|
}
|
|
|
|
|
|
export component A inherits Window {
|
|
// This should lookup the re-defined menubar type and not the builtin one
|
|
MenuBar {
|
|
foobar: 42;
|
|
entries: [];
|
|
// ^error{Unknown property entries in MenuBar}
|
|
}
|
|
}
|
|
|
|
|