treeWidget->clear();
treeWidget->setColumnCount(1);
treeWidget->setHeaderLabel("Select Page");
+ treeWidget->addAction(actionPullWindowOut);
+ treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
m_pages = 0;
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);
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);
}