1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qquickmenuseparator_p.h"
5#include "qquickcontrol_p_p.h"
6
7QT_BEGIN_NAMESPACE
8
9/*!
10 \qmltype MenuSeparator
11 \inherits Control
12//! \instantiates QQuickMenuSeparator
13 \inqmlmodule QtQuick.Controls
14 \since 5.8
15 \ingroup qtquickcontrols-separators
16 \brief Separates a group of items in a menu from adjacent items.
17
18 MenuSeparator is used to visually distinguish between groups of items in a
19 menu by separating them with a line.
20
21 \image qtquickcontrols-menuseparator.png
22
23 \quotefromfile qtquickcontrols-menuseparator-custom.qml
24 \skipto import QtQuick
25 \printuntil import QtQuick.Controls
26 \skipto Menu
27 \printto contentItem.parent: window
28 \skipline contentItem.parent: window
29 \printuntil text: qsTr("Exit")
30 \printuntil }
31 \printuntil }
32
33 \sa {Customizing Menu}, Menu, {Separator Controls}
34*/
35
36class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenuSeparatorPrivate : public QQuickControlPrivate
37{
38 Q_DECLARE_PUBLIC(QQuickMenuSeparator)
39
40public:
41 QPalette defaultPalette() const override { return QQuickTheme::palette(scope: QQuickTheme::Menu); }
42};
43
44QQuickMenuSeparator::QQuickMenuSeparator(QQuickItem *parent)
45 : QQuickControl(*(new QQuickMenuSeparatorPrivate), parent)
46{
47}
48
49QFont QQuickMenuSeparator::defaultFont() const
50{
51 return QQuickTheme::font(scope: QQuickTheme::Menu);
52}
53
54#if QT_CONFIG(accessibility)
55QAccessible::Role QQuickMenuSeparator::accessibleRole() const
56{
57 return QAccessible::Separator;
58}
59#endif
60
61QT_END_NAMESPACE
62
63#include "moc_qquickmenuseparator_p.cpp"
64

source code of qtdeclarative/src/quicktemplates/qquickmenuseparator.cpp