This article shows how to lock the screen orientation of Qt apps in Qt 4.7.2 and later. Note that until Qt 4.7.1, on Symbian developers needed to use native code to lock screen orientation, as shown in Archived:Lock application orientation in Qt.
Platform(s): Qt 4.7.2 and later
// for portrait
attribute = Qt::WA_LockPortraitOrientation;
// for landscape
attribute = Qt::WA_LockLandscapeOrientation;
Where MainWindow inherits from QMainWindow. The function setAttribute belongs to QWidget.