+ // if we have a category, expand the tree and go to the
+ // first item
+ if (item->childCount() > 0) {
+ item->setExpanded(true);
+ if (previous && previous->parent() != item)
+ switchPanel( item->child(0), previous );
+ }
+ else if (QWidget * w = widget_map_.value(item, 0)) {
+ stack_->setCurrentWidget(w);
+ }
+}
+
+
+void PanelStack::itemSelected(QTreeWidgetItem * item, int)
+{
+ // de-select the category if a child is selected
+ if (item->childCount() > 0 && item->child(0)->isSelected())
+ item->setSelected(false);