aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-02-17 17:47:48 +0100
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-02-17 17:47:48 +0100
commit72447b6dbf98ace65ec46559337243970a668d26 (patch)
tree8abf6553218b43b53823cef8f4a02b8522af9f3a /src/quick/items
parent209739056ee7316d9d6e9406aede5465e3bdff84 (diff)
parent04d4dca69d526611b60ec32e873d5de51d10be4d (diff)
Merge dev into 5.7
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/qquickwindow.cpp8
-rw-r--r--src/quick/items/qquickwindowattached.cpp13
-rw-r--r--src/quick/items/qquickwindowattached_p.h5
3 files changed, 22 insertions, 4 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 635f1da77e..10f4fb20fc 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -3872,6 +3872,14 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
+ \qmlattachedproperty Window Window::window
+ \since 5.7
+
+ This attached property holds the item's window.
+ The Window attached property can be attached to any Item.
+*/
+
+/*!
\qmlattachedproperty int Window::width
\qmlattachedproperty int Window::height
\since 5.5
diff --git a/src/quick/items/qquickwindowattached.cpp b/src/quick/items/qquickwindowattached.cpp
index 992bbae382..c6380e2b9a 100644
--- a/src/quick/items/qquickwindowattached.cpp
+++ b/src/quick/items/qquickwindowattached.cpp
@@ -51,9 +51,9 @@ QQuickWindowAttached::QQuickWindowAttached(QObject* attachee)
{
m_attachee = qobject_cast<QQuickItem*>(attachee);
if (m_attachee && m_attachee->window()) // It might not be in a window yet
- windowChanged(m_attachee->window());
+ windowChange(m_attachee->window());
if (m_attachee)
- connect(m_attachee, &QQuickItem::windowChanged, this, &QQuickWindowAttached::windowChanged);
+ connect(m_attachee, &QQuickItem::windowChanged, this, &QQuickWindowAttached::windowChange);
}
QWindow::Visibility QQuickWindowAttached::visibility() const
@@ -86,7 +86,12 @@ int QQuickWindowAttached::height() const
return (m_window ? m_window->height() : 0);
}
-void QQuickWindowAttached::windowChanged(QQuickWindow *window)
+QQuickWindow *QQuickWindowAttached::window() const
+{
+ return m_window;
+}
+
+void QQuickWindowAttached::windowChange(QQuickWindow *window)
{
if (window != m_window) {
QQuickWindow* oldWindow = m_window;
@@ -95,6 +100,8 @@ void QQuickWindowAttached::windowChanged(QQuickWindow *window)
if (oldWindow)
oldWindow->disconnect(this);
+ emit windowChanged();
+
if (!oldWindow || !window || window->visibility() != oldWindow->visibility())
emit visibilityChanged();
if (!oldWindow || !window || window->isActive() != oldWindow->isActive())
diff --git a/src/quick/items/qquickwindowattached_p.h b/src/quick/items/qquickwindowattached_p.h
index 5e4b2c1721..3212508fd8 100644
--- a/src/quick/items/qquickwindowattached_p.h
+++ b/src/quick/items/qquickwindowattached_p.h
@@ -69,6 +69,7 @@ class Q_AUTOTEST_EXPORT QQuickWindowAttached : public QObject
Q_PROPERTY(QQuickItem* contentItem READ contentItem NOTIFY contentItemChanged)
Q_PROPERTY(int width READ width NOTIFY widthChanged)
Q_PROPERTY(int height READ height NOTIFY heightChanged)
+ Q_PROPERTY(QQuickWindow *window READ window NOTIFY windowChanged)
public:
QQuickWindowAttached(QObject* attachee);
@@ -79,6 +80,7 @@ public:
QQuickItem* contentItem() const;
int width() const;
int height() const;
+ QQuickWindow *window() const;
Q_SIGNALS:
@@ -88,9 +90,10 @@ Q_SIGNALS:
void contentItemChanged();
void widthChanged();
void heightChanged();
+ void windowChanged();
protected Q_SLOTS:
- void windowChanged(QQuickWindow*);
+ void windowChange(QQuickWindow*);
private:
QQuickWindow* m_window;