From d7e0fcba590ca6b88a8f40b44101eaf50c6f0ac4 Mon Sep 17 00:00:00 2001 From: luddens Date: Tue, 7 Jan 2020 11:43:25 +0100 Subject: [PATCH] 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. --- src/tabbar.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 4d2e285..f6c9595 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -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); } }