View Single Post
Posts: 306 | Thanked: 603 times | Joined on Jan 2012 @ Belgium
#369
Originally Posted by freemangordon View Post
Well, no idea how it is on Harmattan, but judging from my experience with Qt on Maemo5, one should listen to QDesktopWidget::resized signal and decide on current orientation. You have CSSU with forced rotation enabled, so h-d rotates applications no matter if they want to be rotated. Don't rely on that. The correct way is:

in you MainWindow::MainWindow() you should:

Code:
    setAttribute(Qt::WA_Maemo5AutoOrientation, true);
    connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(orientationChanged()));
and in orientationChanged() slot

Code:
    QRect screenGeometry = QApplication::desktop()->screenGeometry();
    setUpdatesEnabled(false);

    if (screenGeometry.width() > screenGeometry.height())
    {
        /* Do landscape stuff */
    }
    else
    {
        /* Do portrait stuff */
    }
    setUpdatesEnabled(true);
I do it a bit differently. I actually don't care if I am in landscape or
portrait mode. If I just get informed after rotation, that the window
width and height has changed, that is all I need.

Based on what I have read, it is a limitation of pure Qt4 on MeeGo.
The MeeGo SDK has APIs that are somewhat similar to Qt4. I
might have a go at implement it myself, but have no way to test
auto-rotation with the emulator so you guys could give me a hand
with that.

Davy
 

The Following 2 Users Say Thank You to DavyP For This Useful Post: