View Full Version : [QT4 & XP] doubleClick on QtreeView

2nd March 2006, 12:37
Hi, (again) :o

How do I implement doubleClick event without having my QTreeView go into edit mode ?

Single click signal works fine.
When I use doubleClick signal it does two things :
- first executes my slot (which is nice)
- second it goes into edit mode on that column and row.

I tried setEnabled(false) but then the slot is not activated (I guess this is normal).

Cannot find a member that disables the edit mode.
Is it possible ?


connect( table, SIGNAL( doubleClicked(const QModelIndex&) ),
this, SLOT( selection(const QModelIndex&) ) );

2nd March 2006, 12:58
I'm not 100% sure about this, but try to change view's edit triggers.

QAbstractItemView::editTriggers (http://doc.trolltech.com/4.1/qabstractitemview.html#editTriggers-prop)

So removing QAbstractItemView::DoubleClicked ("Editing starts when an item is double clicked.") should do the trick for you.

2nd March 2006, 13:15

code works with :

table->setEditTriggers(QAbstractItemView::NoEditTriggers) ;

table is the QTreeView