Hi all,
I have an application that support auto orientation and use stacked window to transfer between pages. However, if it in portrait mode for first window , and then I switch to second window. The orientation is reseted! It will back to landscape mode.
How can I make it work?
Thx
Example code:
Code:#include <QApplication> #include <QMainWindow> #include <QPushButton> #include <QLabel> int main(int argc, char *argv[]) { QApplication a(argc, argv); QPushButton button1("Click here to open a new stacked window"); button1.setAttribute(Qt::WA_Maemo5StackedWindow); button1.setAttribute(Qt::WA_Maemo5AutoOrientation, true); // The first window QPushButton button2("Click here to open another stacked window", &button1); button2.setAttribute(Qt::WA_Maemo5StackedWindow); button2.setWindowFlags(button2.windowFlags() | Qt::Window); button2.setAttribute(Qt::WA_Maemo5AutoOrientation, true); // The second window QLabel label("<p align=\"center\">This is the last stacked window. " "Press the back arrow on the top-right corner to go back.", &button2, Qt::Window); label.setAttribute(Qt::WA_Maemo5StackedWindow); label.setWordWrap(true); QObject::connect(&button1, SIGNAL(clicked()), &button2, SLOT(show())); QObject::connect(&button2, SIGNAL(clicked()), &label, SLOT(show())); button1.show(); return a.exec(); }

Reply With Quote

