From d0fdebbc378f2d5c1993eee56b63e27bcff04ca5 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 1 Jun 2017 14:44:53 +0200 Subject: Add Overlay attached properties and signals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ChangeLog][Controls][ApplicationWindow] Deprecated the overlay grouped property in favor of the newly introduced Overlay attached properties. [ChangeLog][Controls][Overlay] Introduced Overlay attached properties and signals that supersede the overlay grouped property in Application Window. The Overlay attached type allows providing background dimming for popups without requiring an ApplicationWindow instance. Task-number: QTBUG-61336 Change-Id: I9df11bcb167e7725014d5f058fe24d70da4a10b3 Reviewed-by: Topi Reiniƶ Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickoverlay_p.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/quicktemplates2/qquickoverlay_p.h') diff --git a/src/quicktemplates2/qquickoverlay_p.h b/src/quicktemplates2/qquickoverlay_p.h index ba61c9c9..0d8bccf5 100644 --- a/src/quicktemplates2/qquickoverlay_p.h +++ b/src/quicktemplates2/qquickoverlay_p.h @@ -55,6 +55,8 @@ QT_BEGIN_NAMESPACE class QQmlComponent; class QQuickOverlayPrivate; +class QQuickOverlayAttached; +class QQuickOverlayAttachedPrivate; class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickOverlay : public QQuickItem { @@ -74,6 +76,8 @@ public: static QQuickOverlay *overlay(QQuickWindow *window); + static QQuickOverlayAttached *qmlAttachedProperties(QObject *object); + Q_SIGNALS: void modalChanged(); void modelessChanged(); @@ -101,8 +105,39 @@ private: Q_DECLARE_PRIVATE(QQuickOverlay) }; +class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickOverlayAttached : public QObject +{ + Q_OBJECT + Q_PROPERTY(QQuickOverlay *overlay READ overlay NOTIFY overlayChanged FINAL) + Q_PROPERTY(QQmlComponent *modal READ modal WRITE setModal NOTIFY modalChanged FINAL) + Q_PROPERTY(QQmlComponent *modeless READ modeless WRITE setModeless NOTIFY modelessChanged FINAL) + +public: + explicit QQuickOverlayAttached(QObject *parent = nullptr); + + QQuickOverlay *overlay() const; + + QQmlComponent *modal() const; + void setModal(QQmlComponent *modal); + + QQmlComponent *modeless() const; + void setModeless(QQmlComponent *modeless); + +Q_SIGNALS: + void overlayChanged(); + void modalChanged(); + void modelessChanged(); + void pressed(); + void released(); + +private: + Q_DISABLE_COPY(QQuickOverlayAttached) + Q_DECLARE_PRIVATE(QQuickOverlayAttached) +}; + QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickOverlay) +QML_DECLARE_TYPEINFO(QQuickOverlay, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKOVERLAY_P_H -- cgit v1.2.3