diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2014-11-03 17:23:11 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2014-11-05 16:19:31 +0100 |
commit | 77711c65c1fdb6c5d94d26fef828959d29643516 (patch) | |
tree | 3a6d0e218f1e24863553d42a988fd225cd6144ab /src/quick | |
parent | 5280e866f76e38f2bf1c226ff896b4649194eec4 (diff) |
Add attached Window::contentItem property
This is essential to the Qt Quick Controls for implementing floating
text selection handle popups.
Change-Id: Ibae65110a5db6d65dacd197fef3ad567d11342dc
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 8 | ||||
-rw-r--r-- | src/quick/items/qquickwindowattached.cpp | 6 | ||||
-rw-r--r-- | src/quick/items/qquickwindowattached_p.h | 3 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index f6c1412aff..619e539204 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -1250,6 +1250,14 @@ bool QQuickWindow::isPersistentSceneGraph() const +/*! + \qmlattachedproperty Item Window::contentItem + \since 5.4 + + This attached property holds the invisible root item of the scene or + \c null if the item is not in a window. The Window attached property + can be attached to any Item. +*/ /*! \property QQuickWindow::contentItem diff --git a/src/quick/items/qquickwindowattached.cpp b/src/quick/items/qquickwindowattached.cpp index 121da9e5d9..f74e903be3 100644 --- a/src/quick/items/qquickwindowattached.cpp +++ b/src/quick/items/qquickwindowattached.cpp @@ -65,6 +65,11 @@ QQuickItem *QQuickWindowAttached::activeFocusItem() const return (m_window ? m_window->activeFocusItem() : Q_NULLPTR); } +QQuickItem *QQuickWindowAttached::contentItem() const +{ + return (m_window ? m_window->contentItem() : Q_NULLPTR); +} + void QQuickWindowAttached::windowChanged(QQuickWindow *window) { if (window != m_window) { @@ -83,6 +88,7 @@ void QQuickWindowAttached::windowChanged(QQuickWindow *window) emit activeChanged(); if (!oldWindow || window->activeFocusItem() != oldWindow->activeFocusItem()) emit activeFocusItemChanged(); + emit contentItemChanged(); // QQuickWindowQmlImpl::visibilityChanged also exists, and window might even // be QQuickWindowQmlImpl, but that's not what we are connecting to. diff --git a/src/quick/items/qquickwindowattached_p.h b/src/quick/items/qquickwindowattached_p.h index 12dd273d60..7c2b0bc873 100644 --- a/src/quick/items/qquickwindowattached_p.h +++ b/src/quick/items/qquickwindowattached_p.h @@ -49,6 +49,7 @@ class Q_AUTOTEST_EXPORT QQuickWindowAttached : public QObject Q_PROPERTY(QWindow::Visibility visibility READ visibility NOTIFY visibilityChanged) Q_PROPERTY(bool active READ isActive NOTIFY activeChanged) Q_PROPERTY(QQuickItem* activeFocusItem READ activeFocusItem NOTIFY activeFocusItemChanged) + Q_PROPERTY(QQuickItem* contentItem READ contentItem NOTIFY contentItemChanged) public: QQuickWindowAttached(QObject* attachee); @@ -56,12 +57,14 @@ public: QWindow::Visibility visibility() const; bool isActive() const; QQuickItem* activeFocusItem() const; + QQuickItem* contentItem() const; Q_SIGNALS: void visibilityChanged(); void activeChanged(); void activeFocusItemChanged(); + void contentItemChanged(); protected Q_SLOTS: void windowChanged(QQuickWindow*); |