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.

Fixes: QTBUG-112758
Change-Id: Iff123d1e95f728f51b786106d83a429c111aa6a8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit e6e210c2406e8d4cfe67543871af5fe14a2bda82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 34167f6622196afeb3137df9139d0fe7849691d6)
This commit is contained in:
Morteza Jamshidi 2024-10-29 10:18:00 +01:00 committed by Qt Cherry-pick Bot
parent 39ba5ed46a
commit b4dd1ac675

View File

@ -774,6 +774,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)
}