From: Alan Alpert Date: Sun, 19 Feb 2012 23:35:02 +0000 (+1000) Subject: Fix Screen::AngleBetween X-Git-Tag: upstream/5.2.1~2599 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9d2a09ddbda602c1fb32f23aaa33a9a51989e06c;p=platform%2Fupstream%2Fqtdeclarative.git Fix Screen::AngleBetween 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 Reviewed-by: Samuel Rødal --- diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp index 4b70e2b..b6bd78b 100644 --- a/src/quick/items/qquickscreen.cpp +++ b/src/quick/items/qquickscreen.cpp @@ -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 diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h index 1940f16..7e2c389 100644 --- a/src/quick/items/qquickscreen_p.h +++ b/src/quick/items/qquickscreen_p.h @@ -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*);