ToolButton QML Type

按钮,外观适合ToolBar... 更多...

Import Statement: import QtQuick.Controls
Inherits:

Button

详细描述

ToolButton 在功能上类似于Button ,但提供了更适合ToolBar 的外观。

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()
        }
    }
}

ToolButton 从AbstractButton 继承了其 API。例如,您可以使用AbstractButton API 设置text 、显示图标并对clicks 做出反应。

另请参阅 ToolBar自定义 ToolButton按钮控件

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