
Originally Posted by
anda_skoa
A top level widget (without a parent) or one of the widget window types (QMainWindow, QDialog) has an associated QWindow.
Thank you for that explanation it is good to know.
After a hint from elros I solved my problem by doing this:
include <QtWidgets/QApplication>
include "mainwindow.h"
include <QWindow>
int main(int argc, char *argv[])
{
MainWindow w;
w.show();
QWindow *window = w.windowHandle();
window->reportContentOrientationChange(Qt::LandscapeOrientation);
return a.exec();
}
include <QtWidgets/QApplication>
include "mainwindow.h"
include <QWindow>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
QWindow *window = w.windowHandle();
window->reportContentOrientationChange(Qt::LandscapeOrientation);
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Is this the right way to access the associated QWindow from my MainWindow? However this is working.
Bookmarks