PDA

View Full Version : QTreeWidget disable ctrl to deselect



Alundra
7th January 2016, 21:34
Hi,
Is it possible to disable the deselect action using ctrl + left click on an item of a QTreeWidget ?
How achieve that correctly ?
Thanks

Alundra
8th January 2016, 05:36
Answer :

virtual void mousePressEvent( QMouseEvent* event )
{
QTreeWidgetItem* Item = itemAt( event->pos() );
if( Item && Item != currentItem() )
{
clearSelection();
Item->setSelected( true );
}
event->accept();
}