MenuSeparator QML Type

将菜单中的一组项目与相邻项目分开。更多

Import Statement: import QtQuick.Controls
Inherits:

Control

详细说明

MenuSeparator 用于用一条线分隔菜单中的各组项目,从而在视觉上将它们区分开来。

import QtQuick
import QtQuick.Controls.Basic

Menu {
    id: menu
    MenuItem {
        text: qsTr("New...")
    }
    MenuItem {
        text: qsTr("Open...")
    }
    MenuItem {
        text: qsTr("Save")
    }

    MenuSeparator {
        padding: 0
        topPadding: 12
        bottomPadding: 12
        contentItem: Rectangle {
            implicitWidth: 200
            implicitHeight: 1
            color: "#1E000000"
        }
    }

    MenuItem {
        text: qsTr("Exit")
    }
}

另请参阅 自定义菜单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.