MenuBar QML Type
ネイティブのメニューバー。詳細...
| Import Statement: | import Qt.labs.platform |
| Inherits: |
プロパティ
方法
- void addMenu(Menu menu)
- void clear()
- void insertMenu(int index, Menu menu)
- void removeMenu(Menu menu)
詳細な説明
MenuBar タイプは、ネイティブプラットフォームのメニューバー向けの QML API を提供します。

メニューバーは、ドロップダウンメニューのリストで構成されています。
MenuBar {
id: menuBar
Menu {
id: fileMenu
title: qsTr("File")
// ...
}
Menu {
id: editMenu
title: qsTr("&Edit")
// ...
}
Menu {
id: viewMenu
title: qsTr("&View")
// ...
}
Menu {
id: helpMenu
title: qsTr("&Help")
// ...
}
}MenuBarは現在、以下のプラットフォームで利用可能です:
- macOS
- Android
- Linux(グローバルな D-Bus メニューバーを提供するデスクトップ環境でのみ利用可能)
- Windows
注: Qt.labs モジュール内の型は、将来のバージョンにおいても互換性が保証されるものではありません。
Menuも参照してください 。
プロパティのドキュメント
data : list<QtObject> [default]
このデフォルトのプロパティには、メニューバーの子として宣言されたすべてのオブジェクトのリストが格納されます。data プロパティには、Timer やQtObject など、Menu のインスタンスではないオブジェクトも含まれます。
「menus」も参照してください 。
menus : list<Menu>
このプロパティには、メニューバー内のメニューの一覧が格納されています。
window : Window
このプロパティは、メニューバーのウィンドウを保持します。
明示的に設定されていない場合、ウィンドウは、Window またはウィンドウを持つItem が見つかるまで、QMLの親オブジェクトを順にたどることで自動的に特定されます。
メソッドのドキュメント
void addMenu(Menu menu)
メニューバーの末尾に「menu 」を追加します。
void clear()
メニューバーからすべてのメニューを削除します。
void insertMenu(int index, Menu menu)
メニューバーの指定されたindex に、menu を挿入します。
void removeMenu(Menu menu)
メニューバーから「menu 」を削除します。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.