aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/quick/window/main.cpp4
-rw-r--r--src/quick/items/qquickscreen.cpp62
-rw-r--r--src/quick/items/qquickscreen_p.h10
-rw-r--r--tests/auto/quick/qquickscreen/data/screen.qml3
-rw-r--r--tests/auto/quick/qquickscreen/tst_qquickscreen.cpp2
5 files changed, 11 insertions, 70 deletions
diff --git a/examples/quick/window/main.cpp b/examples/quick/window/main.cpp
index 1a9598a56c..25eb3663ab 100644
--- a/examples/quick/window/main.cpp
+++ b/examples/quick/window/main.cpp
@@ -59,10 +59,6 @@
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
- const auto screens = QGuiApplication::screens();
- for (QScreen *screen : screens)
- screen->setOrientationUpdateMask(Qt::LandscapeOrientation | Qt::PortraitOrientation |
- Qt::InvertedLandscapeOrientation | Qt::InvertedPortraitOrientation);
QQmlEngine engine;
QQmlComponent component(&engine);
QQuickWindow::setDefaultAlphaBuffer(true);
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp
index ed2d7eda3e..9a2799ae96 100644
--- a/src/quick/items/qquickscreen.cpp
+++ b/src/quick/items/qquickscreen.cpp
@@ -213,18 +213,16 @@ QT_BEGIN_NAMESPACE
\qmlattachedproperty Qt::ScreenOrientation Screen::orientation
\readonly
- This contains the current orientation of the screen, from the accelerometer
- (if any). On a desktop computer, this value typically does not change.
-
- If primaryOrientation == orientation, it means that the screen
- automatically rotates all content which is displayed, depending on how you
- hold it. But if orientation changes while primaryOrientation does NOT
- 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.
+ This contains the current orientation of the screen from the
+ window system perspective.
+
+ Most mobile devices and tablet computers contain accelerometer sensors.
+ The Qt Sensors module provides the ability to read this sensor directly.
+ However, the windowing system may rotate the entire screen automatically
+ based on how it is being held, or manually via settings to rotate a desktop
+ monitor; in that case, this \c orientation property will change.
+
+ \sa primaryOrientation(), QWindow::contentOrientation(), QOrientationSensor
*/
/*!
\qmlattachedmethod int Screen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
@@ -233,16 +231,6 @@ QT_BEGIN_NAMESPACE
orientations \a a and \a b.
*/
-/*!
- \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.
-
- By default it is set to the value of the QScreen that the window uses.
-*/
-
QQuickScreenInfo::QQuickScreenInfo(QObject *parent, QScreen *wrappedScreen)
: QObject(parent)
, m_screen(wrappedScreen)
@@ -442,25 +430,6 @@ QQuickScreenAttached::QQuickScreenAttached(QObject* attachee)
screenChanged(QGuiApplication::primaryScreen());
}
-Qt::ScreenOrientations QQuickScreenAttached::orientationUpdateMask() const
-{
- return m_updateMask;
-}
-
-void QQuickScreenAttached::setOrientationUpdateMask(Qt::ScreenOrientations mask)
-{
- m_updateMaskSet = true;
- 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)
@@ -481,17 +450,8 @@ void QQuickScreenAttached::windowChanged(QQuickWindow* c)
void QQuickScreenAttached::screenChanged(QScreen *screen)
{
//qDebug() << "QQuickScreenAttached::screenChanged" << (screen ? screen->name() : QString::fromLatin1("null"));
- if (screen != m_screen) {
+ if (screen != m_screen)
setWrappedScreen(screen);
- if (!m_screen)
- return;
- if (m_updateMaskSet) {
- m_screen->setOrientationUpdateMask(m_updateMask);
- } else if (m_updateMask != m_screen->orientationUpdateMask()) {
- m_updateMask = m_screen->orientationUpdateMask();
- emit orientationUpdateMaskChanged();
- }
- }
}
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h
index 6eb9959aed..78e82a420a 100644
--- a/src/quick/items/qquickscreen_p.h
+++ b/src/quick/items/qquickscreen_p.h
@@ -131,8 +131,6 @@ protected:
class Q_QUICK_PRIVATE_EXPORT QQuickScreenAttached : public QQuickScreenInfo
{
Q_OBJECT
- Q_PROPERTY(Qt::ScreenOrientations orientationUpdateMask READ orientationUpdateMask
- WRITE setOrientationUpdateMask NOTIFY orientationUpdateMaskChanged)
QML_ANONYMOUS
QML_ADDED_IN_VERSION(2, 0);
@@ -140,25 +138,17 @@ class Q_QUICK_PRIVATE_EXPORT QQuickScreenAttached : public QQuickScreenInfo
public:
QQuickScreenAttached(QObject* attachee);
- Qt::ScreenOrientations orientationUpdateMask() const;
- void setOrientationUpdateMask(Qt::ScreenOrientations mask);
-
//Treats int as Qt::ScreenOrientation, due to QTBUG-20639
Q_INVOKABLE int angleBetween(int a, int b);
void windowChanged(QQuickWindow*);
-Q_SIGNALS:
- void orientationUpdateMaskChanged();
-
protected Q_SLOTS:
void screenChanged(QScreen*);
private:
QQuickWindow* m_window = nullptr;
QQuickItem* m_attachee;
- Qt::ScreenOrientations m_updateMask;
- bool m_updateMaskSet = false;
};
class Q_QUICK_PRIVATE_EXPORT QQuickScreen : public QObject
diff --git a/tests/auto/quick/qquickscreen/data/screen.qml b/tests/auto/quick/qquickscreen/data/screen.qml
index cf60d0ae40..5ae008df17 100644
--- a/tests/auto/quick/qquickscreen/data/screen.qml
+++ b/tests/auto/quick/qquickscreen/data/screen.qml
@@ -8,13 +8,10 @@ Item {
property int h: Window.Screen.height
property int curOrientation: Window.Screen.orientation
property int priOrientation: Window.Screen.primaryOrientation
- property int updateMask: Window.Screen.orientationUpdateMask
property real devicePixelRatio: Window.Screen.devicePixelRatio
property int vx: Window.Screen.virtualX
property int vy: Window.Screen.virtualY
- Window.Screen.orientationUpdateMask: Qt.LandscapeOrientation | Qt.InvertedLandscapeOrientation
-
property int screenCount: Qt.application.screens.length
property variant allScreens
diff --git a/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp
index 0a3796402a..ff6031619c 100644
--- a/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp
+++ b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp
@@ -61,7 +61,6 @@ void tst_qquickscreen::basicProperties()
QCOMPARE(screen->size().height(), root->property("h").toInt());
QCOMPARE(int(screen->orientation()), root->property("curOrientation").toInt());
QCOMPARE(int(screen->primaryOrientation()), root->property("priOrientation").toInt());
- QCOMPARE(int(screen->orientationUpdateMask()), root->property("updateMask").toInt());
QCOMPARE(screen->devicePixelRatio(), root->property("devicePixelRatio").toReal());
QVERIFY(screen->devicePixelRatio() >= 1.0);
QCOMPARE(screen->geometry().x(), root->property("vx").toInt());
@@ -86,7 +85,6 @@ void tst_qquickscreen::screenOnStartup()
QCOMPARE(screen->size().height(), root->property("h").toInt());
QCOMPARE(int(screen->orientation()), root->property("curOrientation").toInt());
QCOMPARE(int(screen->primaryOrientation()), root->property("priOrientation").toInt());
- QCOMPARE(int(screen->orientationUpdateMask()), root->property("updateMask").toInt());
QCOMPARE(screen->devicePixelRatio(), root->property("devicePixelRatio").toReal());
QVERIFY(screen->devicePixelRatio() >= 1.0);
QCOMPARE(screen->geometry().x(), root->property("vx").toInt());