diff --git a/src/ViewContainer.cpp b/src/ViewContainer.cpp index 58774fbc1..79993edc5 100644 --- a/src/ViewContainer.cpp +++ b/src/ViewContainer.cpp @@ -430,6 +430,7 @@ TabbedViewContainer::TabbedViewContainer(NavigationPosition position , QObject* _tabBar->setDrawBase(true); _tabBar->setDocumentMode(true); _tabBar->setFocusPolicy(Qt::NoFocus); + _tabBar->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); _newTabButton = new QToolButton(_containerWidget); _newTabButton->setIcon(KIcon("tab-new")); diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp index d5139a92f..3c5db04af 100644 --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -360,13 +360,8 @@ void ViewManager::sessionFinished() Session* session = qobject_cast(sender()); - if ( _sessionMap[qobject_cast(activeView())] == session ) - { - // switch to the next view before deleting the session views to prevent flicker - // occurring as a result of an interval between removing the active view and switching - // to the next view - nextView(); - } + // We're using setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab) + // so no need to manually select next tab. Q_ASSERT(session);