diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2012-01-13 10:31:11 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-24 15:38:48 +0100 |
commit | b39df8bf92a530783144dbcf5cae939742ff2d23 (patch) | |
tree | 0560985d33f59a48693acadbdfbb59b328131499 /src/gui/kernel/qscreen.h | |
parent | b0a0403daf81e82ea732aa91ec92cf94553a7935 (diff) |
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 <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui/kernel/qscreen.h')
-rw-r--r-- | src/gui/kernel/qscreen.h | 18 |
1 files changed, 11 insertions, 7 deletions
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); |