diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-09-24 12:08:10 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@digia.com> | 2014-09-30 09:57:04 +0200 |
commit | 536ead429648f40b874f8d6927bb8f98e8f47a37 (patch) | |
tree | e419d5eaf01c0a363b609574261f6c3ad6a45efd /src/quick/items/qquickscreen.cpp | |
parent | d5b10eda96e2b00a11a2346cb2374af053a5c5af (diff) |
Add orientationUpdateMask to QQuickScreen
Task-number: QTBUG-38699
Change-Id: I173b7e53c27dba336351572859f7c9aeafe07ef9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src/quick/items/qquickscreen.cpp')
-rw-r--r-- | src/quick/items/qquickscreen.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp index 0d9226d77f..926ac7b4ee 100644 --- a/src/quick/items/qquickscreen.cpp +++ b/src/quick/items/qquickscreen.cpp @@ -171,6 +171,9 @@ QT_BEGIN_NAMESPACE change, then probably you are using a device which does not rotate its own display. In that case you may need to use \l {Item::rotation}{Item.rotation} or \l {Item::transform}{Item.transform} to rotate your content. + + \note This property does not update unless a Screen::orientationUpdateMask + is set to a value other than \c 0. */ /*! \qmlattachedmethod int Screen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) @@ -178,10 +181,21 @@ QT_BEGIN_NAMESPACE Returns the rotation angle, in degrees, between the two specified angles. */ +/*! + \qmlattachedproperty Qt::ScreenOrientations Screen::orientationUpdateMask + \since 5.4 + + 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. +*/ + QQuickScreenAttached::QQuickScreenAttached(QObject* attachee) : QObject(attachee) , m_screen(NULL) , m_window(NULL) + , m_updateMask(0) { m_attachee = qobject_cast<QQuickItem*>(attachee); @@ -260,6 +274,24 @@ Qt::ScreenOrientation QQuickScreenAttached::orientation() const return m_screen->orientation(); } +Qt::ScreenOrientations QQuickScreenAttached::orientationUpdateMask() const +{ + return m_updateMask; +} + +void QQuickScreenAttached::setOrientationUpdateMask(Qt::ScreenOrientations mask) +{ + if (m_updateMask == mask) + return; + + m_updateMask = mask; + + if (m_screen) + m_screen->setOrientationUpdateMask(m_updateMask); + + emit orientationUpdateMaskChanged(); +} + int QQuickScreenAttached::angleBetween(int a, int b) { if (!m_screen) @@ -290,6 +322,8 @@ 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 (!oldScreen || screen->size() != oldScreen->size()) { emit widthChanged(); emit heightChanged(); |