I tried it.
// in constructor
QScreen * screen
= QGuiApplication
::primaryScreen();
connect(screen, SIGNAL(orientationChanged(Qt::ScreenOrientation)), this, SLOT(onRotate(Qt::ScreenOrientation)));
screen->setOrientationUpdateMask(Qt::PortraitOrientation| Qt::LandscapeOrientation| Qt::InvertedPortraitOrientation| Qt::InvertedLandscapeOrientation);
void MainWindow::onRotate(Qt::ScreenOrientation)
{
QScreen * screen
= QGuiApplication
::primaryScreen();
QRect r
= screen
->availableGeometry
();
draw(r.height(), r.width());
}
// in constructor
QScreen * screen = QGuiApplication::primaryScreen();
connect(screen, SIGNAL(orientationChanged(Qt::ScreenOrientation)), this, SLOT(onRotate(Qt::ScreenOrientation)));
screen->setOrientationUpdateMask(Qt::PortraitOrientation| Qt::LandscapeOrientation| Qt::InvertedPortraitOrientation| Qt::InvertedLandscapeOrientation);
void MainWindow::onRotate(Qt::ScreenOrientation)
{
QScreen * screen = QGuiApplication::primaryScreen();
QRect r = screen->availableGeometry();
draw(r.height(), r.width());
}
To copy to clipboard, switch view to plain text mode
draw(width, height) is my own stuff. Note I had to reverse the order of the parameters in the call, checked with a showMessage() though, that is the correct order, believe me, i didn't believe it myself, i tried the reverse.
Result is: I get correct screensizes, but when I start in portrait, then rotate, I get the correct drawing but the right side of the screen stays black.
Starting in landscape the same, there the lower part stays black after rotate.
It just refuses to paint in the area that wasn't painted in on startup.
Tried several things, checked the onpaint event if it provides the correct sizes, it does, so I'm stuck and back to 5.2.1 for the moment, there it works (via the onresize).
Bookmarks