closing a tab keeps the scroll position of the right tab

QTabBar::setSelectionBehaviorOnRemove seems to reset the scroll position of
the selected tab, set the current index manually keeps it.
This commit is contained in:
luddens 2020-01-07 11:43:25 +01:00 committed by Kelson
parent e7b986285a
commit d7e0fcba59

View File

@ -252,11 +252,10 @@ void TabBar::closeTab(int index)
void TabBar::setSelectionBehaviorOnRemove(int index)
{
if (index == count() - 2)
{
QTabBar::setSelectionBehaviorOnRemove(QTabBar::SelectLeftTab);
if (index == count() - 2) {
setCurrentIndex(0);
} else {
QTabBar::setSelectionBehaviorOnRemove(QTabBar::SelectRightTab);
setCurrentIndex(index + 1);
}
}