このページでは

MenuBar QML Type

ネイティブ・メニューバー。もっと見る...

Import Statement: import Qt.labs.platform
Inherits:

QtObject

プロパティ

方法

詳細な説明

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プロパティには、TimerQtObject のような、Menu インスタンスではないオブジェクトも含まれます。

menusも参照してください

このプロパティは、メニューバーのメニューのリストを保持する。

window : Window

このプロパティはメニューバーのウィンドウを保持する。

明示的に設定されない限り、ウィンドウはWindow またはItem でウィンドウを持つオブジェクトが見つかるまで QML の親オブジェクトを繰り返し処理することで自動的に解決されます。

メソッドのドキュメント

void addMenu(Menu menu)

メニューバーの最後にmenu を追加する。

void clear()

メニューバーからすべてのメニューを削除する。

void insertMenu(int index, Menu menu)

メニューバーの指定されたindexmenu を挿入する。

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.