aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates/qquickcontextmenu_p.h
blob: 644bf6053ea612eaa572ab1d3c63679747e20bab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QQUICKCONTEXTMENU_P_H
#define QQUICKCONTEXTMENU_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 <QtCore/qobject.h>
#include <QtQml/qqmlregistration.h>
#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>

QT_BEGIN_NAMESPACE

class QQuickContextMenuPrivate;
class QQuickMenu;

class Q_QUICKTEMPLATES2_EXPORT QQuickContextMenu : public QObject, public QQmlParserStatus
{
    Q_OBJECT
    Q_INTERFACES(QQmlParserStatus)
    Q_PROPERTY(QQuickMenu *menu READ menu WRITE setMenu NOTIFY menuChanged FINAL)
    Q_CLASSINFO("DeferredPropertyNames", "menu")
    QML_NAMED_ELEMENT(ContextMenu)
    QML_ATTACHED(QQuickContextMenu)
    QML_UNCREATABLE("")
    QML_ADDED_IN_VERSION(6, 9)

public:
    explicit QQuickContextMenu(QObject *parent = nullptr);

    static QQuickContextMenu *qmlAttachedProperties(QObject *object);

    QQuickMenu *menu() const;
    void setMenu(QQuickMenu *menu);

Q_SIGNALS:
    void menuChanged();
    void requested(QPointF position);

protected:
    bool event(QEvent *) override;

private:
    Q_DECLARE_PRIVATE(QQuickContextMenu)

    void classBegin() override;
    void componentComplete() override;
};

QT_END_NAMESPACE

#endif // QQUICKCONTEXTMENU_P_H