View Single Post
Posts: 3,074 | Thanked: 12,964 times | Joined on Mar 2010 @ Sofia,Bulgaria
#368
Originally Posted by DavyP View Post
I did some investigation, and it seems that Qt4 applications based on
QWidget() don't auto-rate on MeeGo. Unfortunately, that is what I use.

So, for auto-rotation to work on the N9, the UI front-end needs to be
rewritten using the MeeGo Touch APIs.

Davy
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);
 

The Following 3 Users Say Thank You to freemangordon For This Useful Post: