From 4d77f7a3f1a8d1b9cf324fdb9d7a54cf69271e46 Mon Sep 17 00:00:00 2001 From: Jekyll Wu Date: Mon, 15 Aug 2011 10:43:40 +0800 Subject: [PATCH] New tab will be placed to the right of the current tab. This is a improved version, which also works well with split view. --- src/ViewManager.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp index 5feab3833..4efba33e3 100644 --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -600,18 +600,27 @@ void ViewManager::createView(Session* session) emit splitViewToggle(false); } - + int index = -1; + QWidget* activeView = activeView(); + ViewContainer* activeContainer = _viewSplitter->activeContainer(); + + // In all containers the new view will be put at the same position, i.e., + // the position right after the active view in the active container. + if (activeView) + { + QList views = activeContainer->views(); + index = views.indexOf(activeView) + 1; + } + // iterate over the view containers owned by this view manager // and create a new terminal display for the session in each of them, along with // a controller for the session/display pair QListIterator containerIter(_viewSplitter->containers()); - while ( containerIter.hasNext() ) { ViewContainer* container = containerIter.next(); - createView(session,container,-1); + createView(session, container, index); } - } ViewContainer* ViewManager::createContainer(const Profile::Ptr info)