Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickmenubar_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKMENUBAR_P_H
6#define QQUICKMENUBAR_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuickTemplates2/private/qquickcontainer_p.h>
20
22
23QT_BEGIN_NAMESPACE
24
25class QQuickMenu;
26class QQuickMenuBarPrivate;
27class QQmlComponent;
28
29class Q_QUICKTEMPLATES2_EXPORT QQuickMenuBar : public QQuickContainer
30{
31 Q_OBJECT
32 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
33 Q_PRIVATE_PROPERTY(QQuickMenuBar::d_func(), QQmlListProperty<QQuickMenu> menus READ menus NOTIFY menusChanged FINAL)
34 Q_PRIVATE_PROPERTY(QQuickMenuBar::d_func(), QQmlListProperty<QObject> contentData READ contentData FINAL)
35 QML_NAMED_ELEMENT(MenuBar)
36 QML_ADDED_IN_VERSION(2, 3)
37
38public:
39 explicit QQuickMenuBar(QQuickItem *parent = nullptr);
40 ~QQuickMenuBar() override;
41
42 QQmlComponent *delegate() const;
43 void setDelegate(QQmlComponent *delegate);
44
45 Q_INVOKABLE QQuickMenu *menuAt(int index) const;
46 Q_INVOKABLE void addMenu(QQuickMenu *menu);
47 Q_INVOKABLE void insertMenu(int index, QQuickMenu *menu);
48 Q_INVOKABLE void removeMenu(QQuickMenu *menu);
49 Q_INVOKABLE QQuickMenu *takeMenu(int index);
50
51Q_SIGNALS:
52 void delegateChanged();
53 void menusChanged();
54
55protected:
56 bool eventFilter(QObject *object, QEvent *event) override;
57 void keyPressEvent(QKeyEvent *event) override;
58 void keyReleaseEvent(QKeyEvent *event) override;
59 void hoverLeaveEvent(QHoverEvent *event) override;
60
61 bool isContent(QQuickItem *item) const override;
62 void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value) override;
63 void itemAdded(int index, QQuickItem *item) override;
64 void itemMoved(int index, QQuickItem *item) override;
65 void itemRemoved(int index, QQuickItem *item) override;
66
67 void componentComplete() override;
68
69 QFont defaultFont() const override;
70
71#if QT_CONFIG(accessibility)
72 QAccessible::Role accessibleRole() const override;
73#endif
74
75private:
76 Q_DISABLE_COPY(QQuickMenuBar)
77 Q_DECLARE_PRIVATE(QQuickMenuBar)
78};
79
80QT_END_NAMESPACE
81
82#endif // QQUICKMENUBAR_P_H
QT_REQUIRE_CONFIG(quicktemplates2_container)