expand ( const QModelIndex & index )
collapse ( const QModelIndex)
expanded ( const QModelIndex & index )
collapse ( index ); //вызов слота
emit collapsed ( index ); //вызов сигнала и соответственно слота
C++ (Qt)void QTreeView::mousePressEvent(QMouseEvent *event){ Q_D(QTreeView); bool handled = false; if (style()->styleHint(QStyle::SH_Q3ListViewExpand_SelectMouseType, 0, this) == QEvent::MouseButtonPress) handled = d->expandOrCollapseItemAtPos(event->pos()); if (!handled && d->itemDecorationAt(event->pos()) == -1) QAbstractItemView::mousePressEvent(event);}
C++ (Qt)tree->setRootIsDecorated(false);