aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals@canonical.com>2015-02-06 10:40:03 +0100
committerAlbert Astals Cid <albert.astals@canonical.com>2015-02-06 10:08:36 +0000
commit1c678e09c997ee96563404a28820c5068679e633 (patch)
treef53cd08997e319e42a3da1434e6d6ba81d20bef7
parent0b60867f80e207a9ccc27cc337116d1c6fc928bd (diff)
Fix regression where QQuickScreenAttached overwrites QScreen values
Up to Qt 5.3 it was fine setting the orientationUpdateMask in QScreen in C++, with 5.4 that value is always discarded and overwrote with 0, this change makes it possible to still set the orientationUpdateMask value in C++ and not have it overwritten unless specifically changed from QML Change-Id: I134290ce91be8b91df4e9e8e71120753813f48d7 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
-rw-r--r--src/quick/items/qquickscreen.cpp11
-rw-r--r--src/quick/items/qquickscreen_p.h1
2 files changed, 10 insertions, 2 deletions
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp
index 8ac5a1e292..c4d1407697 100644
--- a/src/quick/items/qquickscreen.cpp
+++ b/src/quick/items/qquickscreen.cpp
@@ -197,7 +197,7 @@ QT_BEGIN_NAMESPACE
This contains the update mask for the orientation. Screen::orientation
only emits changes for the screen orientations matching this mask.
- The default, \c 0, means Screen::orientation never updates.
+ By default it is set to the value of the QScreen that the window uses.
*/
QQuickScreenAttached::QQuickScreenAttached(QObject* attachee)
@@ -205,6 +205,7 @@ QQuickScreenAttached::QQuickScreenAttached(QObject* attachee)
, m_screen(NULL)
, m_window(NULL)
, m_updateMask(0)
+ , m_updateMaskSet(false)
{
m_attachee = qobject_cast<QQuickItem*>(attachee);
@@ -297,6 +298,7 @@ Qt::ScreenOrientations QQuickScreenAttached::orientationUpdateMask() const
void QQuickScreenAttached::setOrientationUpdateMask(Qt::ScreenOrientations mask)
{
+ m_updateMaskSet = true;
if (m_updateMask == mask)
return;
@@ -338,7 +340,12 @@ void QQuickScreenAttached::screenChanged(QScreen *screen)
if (!screen)
return; //Don't bother emitting signals, because the new values are garbage anyways
- screen->setOrientationUpdateMask(m_updateMask);
+ if (m_updateMaskSet) {
+ screen->setOrientationUpdateMask(m_updateMask);
+ } else if (m_updateMask != screen->orientationUpdateMask()) {
+ m_updateMask = screen->orientationUpdateMask();
+ emit orientationUpdateMaskChanged();
+ }
if (!oldScreen || screen->size() != oldScreen->size()) {
emit widthChanged();
diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h
index 257b18cfe0..a36641cc71 100644
--- a/src/quick/items/qquickscreen_p.h
+++ b/src/quick/items/qquickscreen_p.h
@@ -106,6 +106,7 @@ private:
QQuickWindow* m_window;
QQuickItem* m_attachee;
Qt::ScreenOrientations m_updateMask;
+ bool m_updateMaskSet;
};
class Q_AUTOTEST_EXPORT QQuickScreen : public QObject