slint/internal/compiler/tests/syntax/elements/menubar.slint
Olivier Goffart 98e8386aee
MenuBar/ContextMenu: hide the entries interface
This can only be used internally by the style to implement the actual
ContextMenu

Only the declarative `MenuItem` interface is exposed.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-01-25 11:06:31 +01:00

37 lines
No EOL
1,009 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 A inherits Window {
mb := MenuBar {
property <int> sub-menu: 45;
// ^error{Cannot re-define internal property 'sub-menu}
property <int> entries: 0;
// ^error{Cannot re-define internal property 'entries'}
}
MenuBar {
// ^error{Only one MenuBar is allowed in a Window}
}
Rectangle {
x: 45px;
}
Rectangle {
x: mb.absolute-position.x;
// ^error{Element 'MenuBar' does not have a property 'absolute-position'}
y: mb.height;
// ^error{Element 'MenuBar' does not have a property 'height'}
init => {
mb.focus();
// ^error{Element 'MenuBar' does not have a property 'focus'}
}
}
}
// TESTS TODO
// - test that setting the window height sets it to the window height plus that of the menubar