1// Copyright (C) 2024 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 QQUICKCONTEXTMENU_P_H
5#define QQUICKCONTEXTMENU_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 <QtCore/qobject.h>
19#include <QtQml/qqmlregistration.h>
20#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
21
22QT_BEGIN_NAMESPACE
23
24class QQuickContextMenuPrivate;
25class QQuickMenu;
26
27class Q_QUICKTEMPLATES2_EXPORT QQuickContextMenu : public QObject, public QQmlParserStatus
28{
29 Q_OBJECT
30 Q_INTERFACES(QQmlParserStatus)
31 Q_PROPERTY(QQuickMenu *menu READ menu WRITE setMenu NOTIFY menuChanged FINAL)
32 Q_CLASSINFO("DeferredPropertyNames", "menu")
33 QML_NAMED_ELEMENT(ContextMenu)
34 QML_ATTACHED(QQuickContextMenu)
35 QML_UNCREATABLE("")
36 QML_ADDED_IN_VERSION(6, 9)
37
38public:
39 explicit QQuickContextMenu(QObject *parent = nullptr);
40
41 static QQuickContextMenu *qmlAttachedProperties(QObject *object);
42
43 QQuickMenu *menu() const;
44 void setMenu(QQuickMenu *menu);
45
46Q_SIGNALS:
47 void menuChanged();
48 void requested(QPointF position);
49
50protected:
51 bool event(QEvent *) override;
52
53private:
54 Q_DECLARE_PRIVATE(QQuickContextMenu)
55
56 void classBegin() override;
57 void componentComplete() override;
58};
59
60QT_END_NAMESPACE
61
62#endif // QQUICKCONTEXTMENU_P_H
63

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