]> git.sur5r.net Git - bacula/bacula/commitdiff
Insert the tabbed widgets as opposed to adding to the end.
authorDirk H Bartley <dbartley@schupan.com>
Fri, 31 Jul 2009 20:40:19 +0000 (20:40 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Fri, 31 Jul 2009 20:40:19 +0000 (20:40 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@9139 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/pages.cpp

index 1b99dbb13cf0dd653f49ae59eb5c5725ca2f1ef4..293bf70758f63e1ccc3e727c474abdcf63027ee1 100644 (file)
@@ -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;