From b39df8bf92a530783144dbcf5cae939742ff2d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 13 Jan 2012 10:31:11 +0100 Subject: Made window orientation API more flexible. Previously we only had QWindow::setOrientation() which was a hint about the orientation the window's contents were rendered in. However, it's necessary to separate between the orientation corresponding to the window buffer layout and orientation of the contents. A game for example might typically want to use a landscape buffer even on a portrait device. Thus, we replace QWindow::orientation() with QWindow::reportContentOrientationChange() and QWindow::requestWindowOrientation(). Change-Id: I1f07362192daf36c45519cb05b43ac352f1945b5 Reviewed-by: Lars Knoll --- src/gui/kernel/qscreen.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/gui/kernel/qscreen.h') diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h index c45590c1b4..aa3d750b41 100644 --- a/src/gui/kernel/qscreen.h +++ b/src/gui/kernel/qscreen.h @@ -81,8 +81,8 @@ class Q_GUI_EXPORT QScreen : public QObject Q_PROPERTY(qreal logicalDotsPerInch READ logicalDotsPerInch NOTIFY logicalDotsPerInchChanged) Q_PROPERTY(QSize availableSize READ availableSize NOTIFY availableSizeChanged) Q_PROPERTY(QRect availableGeometry READ availableGeometry NOTIFY availableGeometryChanged) - Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation CONSTANT) - Q_PROPERTY(Qt::ScreenOrientation currentOrientation READ currentOrientation NOTIFY currentOrientationChanged) + Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ orientation NOTIFY primaryOrientationChanged) + Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged) public: QPlatformScreen *handle() const; @@ -116,11 +116,14 @@ public: QRect availableVirtualGeometry() const; Qt::ScreenOrientation primaryOrientation() const; - Qt::ScreenOrientation currentOrientation() const; + Qt::ScreenOrientation orientation() const; - static int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b); - static QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target); - static QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect); + int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b); + QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target); + QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect); + + bool isPortrait(Qt::ScreenOrientation orientation); + bool isLandscape(Qt::ScreenOrientation orientation); Q_SIGNALS: void sizeChanged(const QSize &size); @@ -133,7 +136,8 @@ Q_SIGNALS: void logicalDotsPerInchChanged(qreal dpi); void availableSizeChanged(const QSize &size); void availableGeometryChanged(const QRect &rect); - void currentOrientationChanged(Qt::ScreenOrientation orientation); + void primaryOrientationChanged(Qt::ScreenOrientation orientation); + void orientationChanged(Qt::ScreenOrientation orientation); private: QScreen(QPlatformScreen *screen); -- cgit v1.2.3