5#include <QQmlComponent>
7#include "qml_material/export.hpp"
15class QML_MATERIAL_API OverlayManager :
public QQuickItem {
19 static OverlayManager* get(QQuickWindow*);
20 ~OverlayManager()
override;
24 void updateDimmer(Popup*);
25 void registerDrawer(Drawer*);
26 void unregisterDrawer(Drawer*);
27 void releaseDrawer(Drawer*);
28 int popupCount()
const {
return m_entries.size(); }
29 bool isWindowDestroying()
const;
32 bool eventFilter(QObject*, QEvent*)
override;
35 explicit OverlayManager(QQuickWindow*);
37 bool press(
const QPointF&);
38 bool release(
const QPointF&);
39 bool blocks(
const QPointF&)
const;
40 Popup* topModal()
const;
41 void restoreFocus(Popup*, QQuickItem*);
42 Drawer* dragCandidate(
const QPointF&)
const;
43 bool drawerPointer(QPointerEvent*,
const QEventPoint&);
44 void cancelDrawerDrag();
47 QPointer<Popup> popup;
48 QPointer<QQuickItem> dimmer;
49 QPointer<QQuickItem> hoverBarrier;
50 QPointer<QQmlComponent> component;
51 QPointer<QQuickItem> previousFocus;
55 QList<Entry> m_entries;
56 quint64 m_nextOrder = 0;
57 QPointer<QQuickWindow> m_window;
58 QList<QPointer<Popup>> m_pressObservers;
59 QList<QPointer<Drawer>> m_drawers;
60 QPointer<Drawer> m_dragDrawer;
61 QPointer<const QPointingDevice> m_dragDevice;
63 bool m_pressed =
false, m_blocked =
false;
64 bool m_destroying =
false;
68class QML_MATERIAL_API Overlay :
public QObject {
70 QML_NAMED_ELEMENT(Overlay)
71 QML_UNCREATABLE(
"Overlay is an attached type")
72 QML_ATTACHED(OverlayAttached)
74 static OverlayAttached* qmlAttachedProperties(QObject*);
77class QML_MATERIAL_API OverlayAttached : public QObject {
79 Q_PROPERTY(QQuickItem* overlay READ overlay NOTIFY overlayChanged FINAL)
80 Q_PROPERTY(QQmlComponent* modal READ modal WRITE setModal NOTIFY modalChanged FINAL)
81 Q_PROPERTY(QQmlComponent* modeless READ modeless WRITE setModeless NOTIFY modelessChanged FINAL)
83 explicit OverlayAttached(QObject*);
84 QQuickItem* overlay()
const;
85 QQmlComponent* modal()
const {
return m_modal; }
86 QQmlComponent* modeless()
const {
return m_modeless; }
87 void setModal(QQmlComponent*);
88 void setModeless(QQmlComponent*);
89 Q_SIGNAL
void overlayChanged();
90 Q_SIGNAL
void modalChanged();
91 Q_SIGNAL
void modelessChanged();
94 QQuickWindow* window()
const;
95 QPointer<QQmlComponent> m_modal, m_modeless;
98QML_DECLARE_TYPEINFO(qml_material::Overlay, QML_HAS_ATTACHED_PROPERTIES)