Hey, 2014-07-17 23:05 GMT+02:00 Piotr Tworek <tworaz...@gmail.com>: > Is there a way to lock application screen orientation to landscape > directly from Qt/C++ code? I know it's possible from QML, but I can't > find any docs how the same can be done from C++.
You can e.g. subclass QWindow to a custom class (so you can handle events, I call that QWindow subclass instance "view" in the code snippet below), then instantiate and show the window (.showFullScreen()) and then tell the system that the content is in landscape like this: // Switch to landscape mode view.reportContentOrientationChange(Qt::LandscapeOrientation); view.screen()->setOrientationUpdateMask(Qt::LandscapeOrientation); You still have a "portrait" window (in the sense that you have to rotate your content in your code, but that's always more efficent than having the compositor do a rotated readout of your window buffer, even if that's done in special 2D blitting hardware that can do multiple-of-90-degrees readouts in hardware), but you can render in landscape (in my case, I render everything in GL ES, so rotating is just applying some forward-rotation to the projection matrix and backward-rotation for handling input). What this will do is: 1. It will make the volume bar appear in landscape orientation 2. It will allow closing the window from the "top" relative to landscape orientation (right screen border on device) 3. Everything else that a landscape window will do that I forgot here HTH :) Thomas _______________________________________________ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org