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#ifndef QQUICKMENUBARITEM_P_H
5#define QQUICKMENUBARITEM_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
19
20QT_BEGIN_NAMESPACE
21
22class QQuickMenu;
23class QQuickMenuBar;
24class QQuickMenuBarItemPrivate;
25
26class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenuBarItem : public QQuickAbstractButton
27{
28 Q_OBJECT
29 Q_PROPERTY(QQuickMenuBar *menuBar READ menuBar NOTIFY menuBarChanged FINAL)
30 Q_PROPERTY(QQuickMenu *menu READ menu WRITE setMenu NOTIFY menuChanged FINAL)
31 Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL)
32 QML_NAMED_ELEMENT(MenuBarItem)
33 QML_ADDED_IN_VERSION(2, 3)
34
35public:
36 explicit QQuickMenuBarItem(QQuickItem *parent = nullptr);
37
38 QQuickMenuBar *menuBar() const;
39
40 QQuickMenu *menu() const;
41 void setMenu(QQuickMenu *menu);
42
43 bool isHighlighted() const;
44 void setHighlighted(bool highlighted);
45
46Q_SIGNALS:
47 void triggered();
48 void menuBarChanged();
49 void menuChanged();
50 void highlightedChanged();
51
52protected:
53 bool event(QEvent *event) override;
54 void keyPressEvent(QKeyEvent *event) override;
55 void keyReleaseEvent(QKeyEvent *event) override;
56
57 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
58
59 QFont defaultFont() const override;
60
61#if QT_CONFIG(accessibility)
62 QAccessible::Role accessibleRole() const override;
63#endif
64
65private:
66 Q_DISABLE_COPY(QQuickMenuBarItem)
67 Q_DECLARE_PRIVATE(QQuickMenuBarItem)
68};
69
70QT_END_NAMESPACE
71
72QML_DECLARE_TYPE(QQuickMenuBarItem)
73
74#endif // QQUICKMENUBARITEM_P_H
75

source code of qtdeclarative/src/quicktemplates/qquickmenubaritem_p.h