Fix Screen::AngleBetween
authorAlan Alpert <alan.alpert@nokia.com>
Sun, 19 Feb 2012 23:35:02 +0000 (09:35 +1000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 20 Feb 2012 10:28:00 +0000 (11:28 +0100)
Enum values in invokables don't worry currently, so use ints.

Also AngleBetween is no longer static, so it has to be initialized
before the function can be used.

Change-Id: I4a6748fef6920bab6f08f22ce68911c3af6ce821
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/quick/items/qquickscreen.cpp
src/quick/items/qquickscreen_p.h

index 4b70e2b..b6bd78b 100644 (file)
@@ -130,9 +130,11 @@ Qt::ScreenOrientation QQuickScreenAttached::orientation() const
     return m_screen->orientation();
 }
 
-int QQuickScreenAttached::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
+int QQuickScreenAttached::angleBetween(int a, int b)
 {
-    return m_screen->angleBetween(a,b);
+    if (!m_screen)
+        return Qt::PrimaryOrientation;
+    return m_screen->angleBetween((Qt::ScreenOrientation)a,(Qt::ScreenOrientation)b);
 }
 
 void QQuickScreenAttached::canvasChanged(QQuickCanvas* c)//Called by QQuickItemPrivate::initCanvas
index 1940f16..7e2c389 100644 (file)
@@ -73,7 +73,8 @@ public:
     Qt::ScreenOrientation primaryOrientation() const;
     Qt::ScreenOrientation orientation() const;
 
-    Q_INVOKABLE int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b);
+    //Treats int as Qt::ScreenOrientation, due to QTBUG-20639
+    Q_INVOKABLE int angleBetween(int a, int b);
 
     void canvasChanged(QQuickCanvas*);