aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2016-07-21 16:04:18 +0200
committerMitch Curtis <mitch.curtis@qt.io>2016-07-25 09:49:51 +0000
commit508bb6ddde831fb0d0b7065b39d99be01b4e4771 (patch)
tree86be3ff28b4d238b11f7ab691e7ce156edbb2822 /src/quicktemplates2
parent8874fddefceaaa86ad85717273ee58a5e84fd883 (diff)
Add MenuSeparator
[ChangeLog][Controls] Added MenuSeparator to visually distinguish between groups of items in a menu. Change-Id: I7a52910b19633ed1188c90ca56c92346a28d4d5c Task-number: QTBUG-54862 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickmenuseparator.cpp80
-rw-r--r--src/quicktemplates2/qquickmenuseparator_p.h75
-rw-r--r--src/quicktemplates2/quicktemplates2.pri2
3 files changed, 157 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickmenuseparator.cpp b/src/quicktemplates2/qquickmenuseparator.cpp
new file mode 100644
index 00000000..9aea6a91
--- /dev/null
+++ b/src/quicktemplates2/qquickmenuseparator.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickmenuseparator_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype MenuSeparator
+ \inherits Control
+ \instantiates QQuickMenuSeparator
+ \inqmlmodule QtQuick.Controls
+ \since 5.8
+ \ingroup qtquickcontrols2-separators
+ \brief Separates a group of items in a menu from adjacent items.
+
+ MenuSeparator is used to visually distinguish between groups of items in a
+ menu by separating them with a line.
+
+ \image qtquickcontrols2-menuseparator.png
+
+ \quotefromfile qtquickcontrols2-menuseparator-custom.qml
+ \skipto import QtQuick 2.6
+ \printuntil import QtQuick.Controls 2.1
+ \skipto Menu
+ \printto contentItem.parent: window
+ \skipline contentItem.parent: window
+ \printuntil text: qsTr("Exit")
+ \printuntil }
+ \printuntil }
+
+ \sa {Customizing MenuSeparator}, {Separator Controls}
+*/
+
+QQuickMenuSeparator::QQuickMenuSeparator(QQuickItem *parent) :
+ QQuickControl(parent)
+{
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickMenuSeparator::accessibleRole() const
+{
+ return QAccessible::Separator;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickmenuseparator_p.h b/src/quicktemplates2/qquickmenuseparator_p.h
new file mode 100644
index 00000000..95a8f8fa
--- /dev/null
+++ b/src/quicktemplates2/qquickmenuseparator_p.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKMENUSEPARATOR_P_H
+#define QQUICKMENUSEPARATOR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenuSeparator : public QQuickControl
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickMenuSeparator(QQuickItem *parent = nullptr);
+
+protected:
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickMenuSeparator)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickMenuSeparator)
+
+#endif // QQUICKMENUSEPARATOR_P_H
diff --git a/src/quicktemplates2/quicktemplates2.pri b/src/quicktemplates2/quicktemplates2.pri
index 20c76d8a..f5e95aea 100644
--- a/src/quicktemplates2/quicktemplates2.pri
+++ b/src/quicktemplates2/quicktemplates2.pri
@@ -30,6 +30,7 @@ HEADERS += \
$$PWD/qquickmenu_p.h \
$$PWD/qquickmenu_p_p.h \
$$PWD/qquickmenuitem_p.h \
+ $$PWD/qquickmenuseparator_p.h \
$$PWD/qquickoverlay_p.h \
$$PWD/qquickpage_p.h \
$$PWD/qquickpageindicator_p.h \
@@ -88,6 +89,7 @@ SOURCES += \
$$PWD/qquicklabel.cpp \
$$PWD/qquickmenu.cpp \
$$PWD/qquickmenuitem.cpp \
+ $$PWD/qquickmenuseparator.cpp \
$$PWD/qquickoverlay.cpp \
$$PWD/qquickpage.cpp \
$$PWD/qquickpageindicator.cpp \