Change window activation order if active window is moved

Active window should always be in front of the stack so bring it to the
front of the stack if it's not.

Pick-to: 6.8 6.9
Fixes: QTBUG-112758
Change-Id: Iff123d1e95f728f51b786106d83a429c111aa6a8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Morteza Jamshidi 2024-10-29 10:18:00 +01:00
parent ccc99bcf8b
commit e6e210c240

View File

@ -772,6 +772,17 @@ void QMdiAreaPrivate::_q_moveTab(int from, int to)
Q_UNUSED(to);
#else
childWindows.move(from, to);
// Put the active window in front to update activation order.
const int indexToActiveWindow = childWindows.indexOf(active);
if (indexToActiveWindow != -1) {
const int index = indicesToActivatedChildren.indexOf(indexToActiveWindow);
Q_ASSERT(index != -1);
if (index != 0) { // if it's not in front
indicesToActivatedChildren.move(index, 0);
internalRaise(active);
}
}
#endif // QT_CONFIG(tabbar)
}