Fix grouped dock widget from shifting down when created

Animated .git attached to the bug report for easy understanding.

Looks like we shouldn't set window flags after a setGeometry() and
before having the window resources. If we do that, then the requested
geometry won't be honoured. No idea if it can be fixable in the QPA
and won't risk doing it there.

Fixes the problem on macOS and Windows.
On Linux it was OK, and still is.

Task-number: QTBUG-67611
Change-Id: I8244b4956a5ac9afcf257bea762c2c3084b563f8
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
bb10
Sergio Martins 2018-04-10 17:21:40 +01:00 committed by Sérgio Martins
parent a553e2f6b5
commit 5de49ab4ed
1 changed files with 2 additions and 0 deletions

View File

@ -467,6 +467,8 @@ void QDockWidgetGroupWindow::adjustFlags()
}
if (oldFlags != flags) {
if (!windowHandle())
create(); // The desired geometry is forgotten if we call setWindowFlags before having a window
setWindowFlags(flags);
const bool gainedNativeDecos = (oldFlags & Qt::FramelessWindowHint) && !(flags & Qt::FramelessWindowHint);
const bool lostNativeDecos = !(oldFlags & Qt::FramelessWindowHint) && (flags & Qt::FramelessWindowHint);