From: Dirk H Bartley Date: Fri, 31 Jul 2009 20:40:19 +0000 (+0000) Subject: Insert the tabbed widgets as opposed to adding to the end. X-Git-Tag: Release-5.0.0~423 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=73b6afe020296781d589a1f4f469bb6f146dea72;p=bacula%2Fbacula Insert the tabbed widgets as opposed to adding to the end. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@9139 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/pages.cpp b/bacula/src/qt-console/pages.cpp index 1b99dbb13c..293bf70758 100644 --- a/bacula/src/qt-console/pages.cpp +++ b/bacula/src/qt-console/pages.cpp @@ -68,8 +68,22 @@ void Pages::dockPage() */ setWindowFlags(Qt::Widget); + /* calculate the index that the tab should be inserted into */ + int tabPos = 0; + QTreeWidgetItemIterator it(mainWin->treeWidget); + while (*it) { + Pages *somepage = mainWin->getFromHash(*it); + if (this == somepage) { + tabPos += 1; + break; + } + int pageindex = mainWin->tabWidget->indexOf(somepage); + if (pageindex != -1) { tabPos = pageindex; } + ++it; + } + /* This was being done already */ - m_parent->addTab(this, m_name); + m_parent->insertTab(tabPos, this, m_name); /* Set docked flag */ m_docked = true;