本页内容

ToolSeparator QML Type

将工具栏中的一组项目与相邻项目分隔开来。更多...

Import Statement: import QtQuick.Controls
Inherits:

Control

属性

详细说明

ToolSeparator 用于通过一条分隔线将工具栏中的项目组视觉上区分开来。通过将orientation 属性分别设置为Qt.Vertical 或Qt.Horizontal ,它可用于水平或垂直工具栏。

用于分隔工具栏按钮的工具分隔符

ToolBar {
    RowLayout {
        anchors.fill: parent

        ToolButton {
            text: qsTr("Action 1")
        }
        ToolButton {
            text: qsTr("Action 2")
        }

        ToolSeparator {}

        ToolButton {
            text: qsTr("Action 3")
        }
        ToolButton {
            text: qsTr("Action 4")
        }

        ToolSeparator {}

        ToolButton {
            text: qsTr("Action 5")
        }
        ToolButton {
            text: qsTr("Action 6")
        }

        Item {
            Layout.fillWidth: true
        }
    }
}

另请参阅 “自定义 ToolSeparator和Separator 控件”。

属性文档

horizontal : bool [read-only]

该属性表示orientation 是否等于Qt.Horizontal 。

该属性对于自定义 ToolSeparator 非常有用。

另请参阅 orientation 和vertical 。

orientation : enumeration

该属性用于指定工具分隔符的朝向。

可能的值:

常量说明
Qt.Horizontal在垂直工具栏中使用水平分隔符。
Qt.Vertical在水平工具栏中使用垂直分隔线。(默认)

vertical : bool [read-only]

该属性用于判断orientation 是否等于Qt.Vertical 。

该属性有助于自定义 ToolSeparator。

另请参阅 orientation 和horizontal 。

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