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 を削除する。


© 2025 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.