PDA

View Full Version : QTreewidget : Highligth only one item when select a row



KraCk
29th May 2012, 15:42
Hello,

I use a QTreewidget with 4 columns and when I select a row, i don't want the entire row to be highlighted, but only the item in column 1 (even if I select the row by clicking on another column). I don't find how to do this.

Thanks for your help

Jonny174
30th May 2012, 03:09
Try reimplement mousePressEvent.


void TreeWidget::mousePressEvent( QMouseEvent *e )
{
selectionModel()->setCurrentIndex( indexAt( e->pos() ), QItemSelectionModel::ClearAndSelect );
QTreeWidget::mousePressEvent(e);
}