Windows: Restore maximized/full screen widgets to correct screen.
Partially revert 54865d47cfd859a0e84ba8e1bbff3b56c93d4e0d and bring back parts from abba37cd0eff959edf2d011842cbf2b36cce8467 which failed some tests on other platforms and never made it in. Avoid setting a geometry on maximized windows since that leaves them in a broken state. Instead, if there is a need to restore maximized windows to a different screen, clear the maximized flag before applying the geometry. [ChangeLog][QWidget][Windows] QWidget::restoreGeometry() now restores maximized/full screen widgets to the correct screen. Task-number: QTBUG-21371 Task-number: QTBUG-4397 Change-Id: Ibd5b736e921f20d4b7365c06c6f9c5dd4469c781 Reviewed-by: Andy Shaw <andy.shaw@digia.com>
This commit is contained in:
parent
c1bea0b532
commit
ae4243df1e
@ -6747,12 +6747,25 @@ bool QWidget::restoreGeometry(const QByteArray &geometry)
|
||||
if (maximized || fullScreen) {
|
||||
// set geometry before setting the window state to make
|
||||
// sure the window is maximized to the right screen.
|
||||
// Skip on windows: the window is restored into a broken
|
||||
// half-maximized state.
|
||||
Qt::WindowStates ws = windowState();
|
||||
#ifndef Q_OS_WIN
|
||||
setGeometry(restoredNormalGeometry);
|
||||
#endif
|
||||
Qt::WindowStates ws = windowState();
|
||||
#else
|
||||
if (ws & Qt::WindowFullScreen) {
|
||||
// Full screen is not a real window state on Windows.
|
||||
move(availableGeometry.topLeft());
|
||||
} else if (ws & Qt::WindowMaximized) {
|
||||
// Setting a geometry on an already maximized window causes this to be
|
||||
// restored into a broken, half-maximized state, non-resizable state (QTBUG-4397).
|
||||
// Move the window in normal state if needed.
|
||||
if (restoredScreenNumber != desktop->screenNumber(this)) {
|
||||
setWindowState(Qt::WindowNoState);
|
||||
setGeometry(restoredNormalGeometry);
|
||||
}
|
||||
} else {
|
||||
setGeometry(restoredNormalGeometry);
|
||||
}
|
||||
#endif // Q_OS_WIN
|
||||
if (maximized)
|
||||
ws |= Qt::WindowMaximized;
|
||||
if (fullScreen)
|
||||
|
Loading…
Reference in New Issue
Block a user