ToolBar QML Type

コンテキスト・コントロールのコンテナ。詳細...

Import Statement: import QtQuick.Controls
Inherits:

Pane

プロパティ

詳細説明

ToolBarは、ナビゲーション・ボタンや検索フィールドなど、アプリケーション全体やコンテキストに応じたアクションやコントロールのコンテナです。ToolBar は、一般的にheader またはApplicationWindowfooter として使用されます。

ToolBarは、それ自体のレイアウトを提供しませんが、例えば、RowLayout を作成することによって、そのコンテンツを配置する必要があります。単一のアイテムのみが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
    }
}

ApplicationWindowToolButtonToolBarのカスタマイズ、およびコンテナ・コントロールも参照してください

プロパティの説明

position : enumeration

このプロパティは、ツールバーの位置を保持する。

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

設定可能な値

定数説明
ToolBar.Headerツールバーは、ウィンドウまたはページのヘッダーとして、一番上にあります。
ToolBar.Footerツールバーは、ウィンドウまたはページのフッターとして、一番下にあります。

デフォルト値はスタイル固有です。

ApplicationWindow::header,ApplicationWindow::footer,Page::header,Page::footerも参照してください


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