このページでは

ToolBar QML Type

コンテキスト依存のコントロールを格納するためのコンテナ。詳細...

Import Statement: import QtQuick.Controls
Inherits:

Pane

プロパティ

詳細説明

ToolBarは、ナビゲーションボタンや検索フィールドなど、アプリケーション全体で利用可能なアクションやコントロール、およびコンテキストに応じたアクションやコントロールを格納するコンテナです。ToolBarは、通常、ApplicationWindow のheader またはfooter として使用されます。

ToolBar 自体には独自のレイアウト機能はなく、RowLayout を作成するなどして、その内容を配置する必要があります。ToolBar 内で 1 つのアイテムのみが使用される場合、ToolBar はそのアイテムの暗黙的なサイズに合わせてサイズが調整されます。このため、レイアウトとの併用に特に適しています。

ボタンやその他のコントロールが含まれるツールバー

ApplicationWindow {
    visible:true

    header: ToolBar {
        RowLayout {
            anchors.fill: parent
            ToolButton {
                text: qsTr("‹")
                onClicked: stack.pop()
            }
            Label {
                text: "Title"
                elide: Label.ElideRight
                horizontalAlignment: Qt.AlignHCenter
                verticalAlignment: Qt.AlignVCenter
                Layout.fillWidth: true
            }
            ToolButton {
                text: qsTr("⋮")
                onClicked: menu.open()
            }
        }
    }

    StackView {
        id: stack
        anchors.fill: parent
    }
}

「 ApplicationWindow」 、「ToolButton 」、「ToolBarのカスタマイズ」、および「コンテナコントロール」も参照してください 。

プロパティのドキュメント

position : enumeration

このプロパティは、ツールバーの位置を指定します。

注: ツールバーがApplicationWindow またはPage のヘッダーまたはフッターとして割り当てられている場合 、適切な位置が自動的に設定されます。

取り得る値:

定数説明
ToolBar.Headerツールバーは、ウィンドウまたはページのヘッダーとして上部に配置されます。
ToolBar.Footerツールバーは、ウィンドウまたはページのフッターとして、最下部に配置されます。

デフォルト値はスタイルによって異なります。

関連項目: ApplicationWindow::header 、ApplicationWindow::footer 、Page::header 、およびPage::footer 。

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