aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickwindowattached.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-01-05 21:00:40 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-01-09 21:40:52 +0100
commit40f394ef2e06a6466445e4df54735250939084f0 (patch)
tree815635f1adf7b2dee2ee271e9092f96695c41936 /src/quick/items/qquickwindowattached.cpp
parentb40a2a881291b3eaea4b4834a162091537e6a34e (diff)
Add Window.width and Window.height attached properties
[ChangeLog][QtQuick] Added Window.width and Window.height attached properties Change-Id: I3ef590a0d3e6fa660ed88992d5ae843deb09c7bc Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/quick/items/qquickwindowattached.cpp')
-rw-r--r--src/quick/items/qquickwindowattached.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/quick/items/qquickwindowattached.cpp b/src/quick/items/qquickwindowattached.cpp
index f74e903be3..70985bdd45 100644
--- a/src/quick/items/qquickwindowattached.cpp
+++ b/src/quick/items/qquickwindowattached.cpp
@@ -70,6 +70,16 @@ QQuickItem *QQuickWindowAttached::contentItem() const
return (m_window ? m_window->contentItem() : Q_NULLPTR);
}
+int QQuickWindowAttached::width() const
+{
+ return (m_window ? m_window->width() : 0);
+}
+
+int QQuickWindowAttached::height() const
+{
+ return (m_window ? m_window->height() : 0);
+}
+
void QQuickWindowAttached::windowChanged(QQuickWindow *window)
{
if (window != m_window) {
@@ -89,6 +99,10 @@ void QQuickWindowAttached::windowChanged(QQuickWindow *window)
if (!oldWindow || window->activeFocusItem() != oldWindow->activeFocusItem())
emit activeFocusItemChanged();
emit contentItemChanged();
+ if (!oldWindow || window->width() != oldWindow->width())
+ emit widthChanged();
+ if (!oldWindow || window->height() != oldWindow->height())
+ emit heightChanged();
// QQuickWindowQmlImpl::visibilityChanged also exists, and window might even
// be QQuickWindowQmlImpl, but that's not what we are connecting to.
@@ -102,6 +116,10 @@ void QQuickWindowAttached::windowChanged(QQuickWindow *window)
this, &QQuickWindowAttached::activeChanged);
connect(window, &QQuickWindow::activeFocusItemChanged,
this, &QQuickWindowAttached::activeFocusItemChanged);
+ connect(window, &QQuickWindow::widthChanged,
+ this, &QQuickWindowAttached::widthChanged);
+ connect(window, &QQuickWindow::heightChanged,
+ this, &QQuickWindowAttached::heightChanged);
}
}