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/qplatformscreen_qpa.cpp | |
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/qplatformscreen_qpa.cpp')
-rw-r--r-- | src/gui/kernel/qplatformscreen_qpa.cpp | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp index 7006b77a36..37a3aeddc8 100644 --- a/src/gui/kernel/qplatformscreen_qpa.cpp +++ b/src/gui/kernel/qplatformscreen_qpa.cpp @@ -160,36 +160,15 @@ QDpi QPlatformScreen::logicalDpi() const } /*! - Reimplement this function in subclass to return the primary orientation - of the screen, i.e. the orientation the display controller or equivalent - expects. - - The default implementation returns Qt::PortraitOrientation if the - geometry's height is greater or Qt::LandscapeOrientation if the geometry's - width is greater. -*/ -Qt::ScreenOrientation QPlatformScreen::primaryOrientation() const -{ - return geometry().height() > geometry().width() ? Qt::PortraitOrientation : - Qt::LandscapeOrientation; -} - -/*! Reimplement this function in subclass to return the current orientation of the screen, for example based on accelerometer data to determine - the physical screen orientation. - - The current orientation is only a hint to the application saying - what the preferred application orientation should be, the application - is free to limit itself to a certain set of supported orientations. - - The default implementation returns the same as primaryOrientation(). + the device orientation. - \sa primaryOrientation() + The default implementation returns Qt::PrimaryOrientation. */ -Qt::ScreenOrientation QPlatformScreen::currentOrientation() const +Qt::ScreenOrientation QPlatformScreen::orientation() const { - return primaryOrientation(); + return Qt::PrimaryOrientation; } QPlatformScreen * QPlatformScreen::platformScreenForWindow(const QWindow *window) |