diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-10-04 13:11:30 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-07 22:23:30 +0200 |
commit | c66b7cf55b6913dcf33d49d4f6bf9db51ccf39a8 (patch) | |
tree | 430983856f993de5618aa5d8d0198b2db98eda97 /src/gui/kernel/qguiapplication.cpp | |
parent | 090d825e1d853a2ed875329a8350b0a727c3527e (diff) |
Added Orientation API to QScreen and QWindow.
QScreen now has a primary and current orientation, and a QWindow can set
its orientation as well. The current screen orientation is just a hint
to the application.
Change-Id: I4635982cfac2d16634d4edd5c6ab78e9d0ac55a4
Reviewed-on: http://codereview.qt-project.org/5988
Reviewed-by: Paul Olav Tvete <paul.tvete@nokia.com>
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 29b961a170..723f69199f 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -533,9 +533,9 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv QGuiApplicationPrivate::processCloseEvent( static_cast<QWindowSystemInterfacePrivate::CloseEvent *>(e)); break; - case QWindowSystemInterfacePrivate::ScreenCountChange: - QGuiApplicationPrivate::reportScreenCount( - static_cast<QWindowSystemInterfacePrivate::ScreenCountEvent *>(e)); + case QWindowSystemInterfacePrivate::ScreenOrientation: + QGuiApplicationPrivate::reportScreenOrientationChange( + static_cast<QWindowSystemInterfacePrivate::ScreenOrientationEvent *>(e)); break; case QWindowSystemInterfacePrivate::ScreenGeometry: QGuiApplicationPrivate::reportGeometryChange( @@ -919,16 +919,20 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To } } -void QGuiApplicationPrivate::reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *) +void QGuiApplicationPrivate::reportScreenOrientationChange(QWindowSystemInterfacePrivate::ScreenOrientationEvent *e) { // This operation only makes sense after the QGuiApplication constructor runs if (QCoreApplication::startingUp()) return; - //QGuiApplication::desktop()->d_func()->updateScreenList(); - // signal anything listening for creation or deletion of screens - //QDesktopWidget *desktop = QGuiApplication::desktop(); - //emit desktop->screenCountChanged(e->count); + if (!e->screen) + return; + + QScreen *s = e->screen.data(); + emit s->currentOrientationChanged(s->currentOrientation()); + + QScreenOrientationChangeEvent event(s, s->currentOrientation()); + QCoreApplication::sendEvent(QCoreApplication::instance(), &event); } void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *) |