From: Kern Sibbald Date: Tue, 27 Mar 2007 19:57:32 +0000 (+0000) Subject: Add context menu to page selection X-Git-Tag: Release-7.0.0~6687 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5b7a1556f40fa40efda3a86c8745ebec62fa0c70;p=bacula%2Fbacula Add context menu to page selection git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4438 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 0c8ceee551..3400c83760 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -46,6 +46,8 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent) treeWidget->clear(); treeWidget->setColumnCount(1); treeWidget->setHeaderLabel("Select Page"); + treeWidget->addAction(actionPullWindowOut); + treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu); m_pages = 0; createPages(); @@ -119,7 +121,7 @@ void MainWin::createPages() } /* Create a root Tree Widget */ -QTreeWidgetItem *MainWin::createTopPage(char *name ) +QTreeWidgetItem *MainWin::createTopPage(char *name) { QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget); item->setText(0, name); @@ -228,10 +230,12 @@ void MainWin::readSettings() void MainWin::treeItemClicked(QTreeWidgetItem *item, int column) { - column+=0; + (void)column; + /* Use tree item's Qt::UserRole to get treeindex */ int treeindex = item->data(column, Qt::UserRole).toInt(); - int stackindex=stackedWidget->indexOf( m_bstacklist[treeindex] ); + int stackindex=stackedWidget->indexOf(m_bstacklist[treeindex]); + if( stackindex >= 0 ){ stackedWidget->setCurrentIndex(stackindex); }