diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2014-10-29 09:58:03 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@digia.com> | 2015-01-12 21:22:35 +0100 |
commit | 6b808b1eee4956286995ad9b1c2e81ae4b1a5884 (patch) | |
tree | 1d8af49173d374ba65e5c7f518b1d6cc8a33c754 /src/quick/items/qquickscreen.cpp | |
parent | c5b575bdc26b54e4807760c9731e9b9752f56f21 (diff) |
Improve startup of bindings using QQuickScreen
We can optimistically initialize the underlying QScreen to the primary
screen and this way ensure that in the common case the evaluation of
bindings using the screen's attached properties results in correct calculations
on startup. This way we can avoid re-evaluating the bindings again later.
Previously on startup all the returned values were zero and the bindings got
evaluated again once a window was assigned.
Change-Id: I98ba5905953f0b5054d924919239d178570250d3
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/quick/items/qquickscreen.cpp')
-rw-r--r-- | src/quick/items/qquickscreen.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp index 8ac5a1e292..2e104673af 100644 --- a/src/quick/items/qquickscreen.cpp +++ b/src/quick/items/qquickscreen.cpp @@ -37,6 +37,7 @@ #include "qquickitem_p.h" #include "qquickwindow.h" +#include <QGuiApplication> #include <QScreen> QT_BEGIN_NAMESPACE @@ -218,6 +219,9 @@ QQuickScreenAttached::QQuickScreenAttached(QObject* attachee) if (window) windowChanged(window); } + + if (!m_screen) + screenChanged(QGuiApplication::primaryScreen()); } QString QQuickScreenAttached::name() const |