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_REQUIRE_CONFIG(quicktemplates2_container);
21
22QT_BEGIN_NAMESPACE
23
24class QQuickMenu;
25class QQuickMenuBar;
26class QQuickMenuBarItemPrivate;
27
28class Q_QUICKTEMPLATES2_EXPORT QQuickMenuBarItem : public QQuickAbstractButton
29{
30 Q_OBJECT
31 Q_PROPERTY(QQuickMenuBar *menuBar READ menuBar NOTIFY menuBarChanged FINAL)
32 Q_PROPERTY(QQuickMenu *menu READ menu WRITE setMenu NOTIFY menuChanged FINAL)
33 Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL)
34 QML_NAMED_ELEMENT(MenuBarItem)
35 QML_ADDED_IN_VERSION(2, 3)
36
37public:
38 explicit QQuickMenuBarItem(QQuickItem *parent = nullptr);
39
40 QQuickMenuBar *menuBar() const;
41
42 QQuickMenu *menu() const;
43 void setMenu(QQuickMenu *menu);
44
45 bool isHighlighted() const;
46 void setHighlighted(bool highlighted);
47
48Q_SIGNALS:
49 void triggered();
50 void menuBarChanged();
51 void menuChanged();
52 void highlightedChanged();
53
54protected:
55 bool event(QEvent *event) override;
56 void keyPressEvent(QKeyEvent *event) override;
57 void keyReleaseEvent(QKeyEvent *event) override;
58
59 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
60
61 QFont defaultFont() const override;
62
63#if QT_CONFIG(accessibility)
64 QAccessible::Role accessibleRole() const override;
65#endif
66
67private:
68 Q_DISABLE_COPY(QQuickMenuBarItem)
69 Q_DECLARE_PRIVATE(QQuickMenuBarItem)
70};
71
72QT_END_NAMESPACE
73
74#endif // QQUICKMENUBARITEM_P_H
75

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

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