private: QProcess *m_process;
#include <QApplication> #include <QDesktopWidget> ... connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(onOrientationChanged())); ... void MainWindow::onOrientationChanged() { QRect screen = QApplication::desktop()->screenGeometry(); if (screen.width() > screen.height()) { setLandscapeLayout(); } else { setPortraitLayout(); } } void MainWindow::setLandscapeLayout() { do stuff } void MainWindow::setPortraitLayout() { do stuff }