W3cubDocs

/Qt 5.15

MenuSeparator QML Type

Separates a group of items in a menu from adjacent items. More...

Import Statement: import QtQuick.Controls 2.15
Since: Qt 5.8
Inherits:

Control

Detailed Description

MenuSeparator is used to visually distinguish between groups of items in a menu by separating them with a line.

import QtQuick 2.12
import QtQuick.Controls 2.12

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

See also Customizing Menu, Menu, and Separator Controls.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5.15/qml-qtquick-controls2-menuseparator.html