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 QQUICKOVERLAY_P_H
5#define QQUICKOVERLAY_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 <QtQuick/qquickitem.h>
19#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class QQmlComponent;
24class QQuickOverlayPrivate;
25class QQuickOverlayAttached;
26class QQuickOverlayAttachedPrivate;
27
28class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickOverlay : public QQuickItem
29{
30 Q_OBJECT
31 Q_PROPERTY(QQmlComponent *modal READ modal WRITE setModal NOTIFY modalChanged FINAL)
32 Q_PROPERTY(QQmlComponent *modeless READ modeless WRITE setModeless NOTIFY modelessChanged FINAL)
33 QML_NAMED_ELEMENT(Overlay)
34 QML_ATTACHED(QQuickOverlayAttached)
35 QML_UNCREATABLE("")
36 QML_ADDED_IN_VERSION(2, 3)
37
38public:
39 explicit QQuickOverlay(QQuickItem *parent = nullptr);
40 ~QQuickOverlay();
41
42 QQmlComponent *modal() const;
43 void setModal(QQmlComponent *modal);
44
45 QQmlComponent *modeless() const;
46 void setModeless(QQmlComponent *modeless);
47
48 static QQuickOverlay *overlay(QQuickWindow *window);
49
50 static QQuickOverlayAttached *qmlAttachedProperties(QObject *object);
51
52Q_SIGNALS:
53 void modalChanged();
54 void modelessChanged();
55 void pressed();
56 void released();
57
58protected:
59 void itemChange(ItemChange change, const ItemChangeData &data) override;
60 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
61
62 void mousePressEvent(QMouseEvent *event) override;
63 void mouseMoveEvent(QMouseEvent *event) override;
64 void mouseReleaseEvent(QMouseEvent *event) override;
65#if QT_CONFIG(quicktemplates2_multitouch)
66 void touchEvent(QTouchEvent *event) override;
67#endif
68#if QT_CONFIG(wheelevent)
69 void wheelEvent(QWheelEvent *event) override;
70#endif
71 bool childMouseEventFilter(QQuickItem *item, QEvent *event) override;
72 bool eventFilter(QObject *object, QEvent *event) override;
73
74private:
75 Q_DISABLE_COPY(QQuickOverlay)
76 Q_DECLARE_PRIVATE(QQuickOverlay)
77};
78
79class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickOverlayAttached : public QObject
80{
81 Q_OBJECT
82 Q_PROPERTY(QQuickOverlay *overlay READ overlay NOTIFY overlayChanged FINAL)
83 Q_PROPERTY(QQmlComponent *modal READ modal WRITE setModal NOTIFY modalChanged FINAL)
84 Q_PROPERTY(QQmlComponent *modeless READ modeless WRITE setModeless NOTIFY modelessChanged FINAL)
85
86public:
87 explicit QQuickOverlayAttached(QObject *parent = nullptr);
88
89 QQuickOverlay *overlay() const;
90
91 QQmlComponent *modal() const;
92 void setModal(QQmlComponent *modal);
93
94 QQmlComponent *modeless() const;
95 void setModeless(QQmlComponent *modeless);
96
97Q_SIGNALS:
98 void overlayChanged();
99 void modalChanged();
100 void modelessChanged();
101 void pressed();
102 void released();
103
104private:
105 Q_DISABLE_COPY(QQuickOverlayAttached)
106 Q_DECLARE_PRIVATE(QQuickOverlayAttached)
107};
108
109QT_END_NAMESPACE
110
111QML_DECLARE_TYPE(QQuickOverlay)
112
113#endif // QQUICKOVERLAY_P_H
114

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