View Full Version : Emit clicked( QModelIndex &) from a QTreeView?

15th December 2008, 03:29
I am editing a widget with a QTreeView connected with a QDirModel. I want to enable a `rename' function in the context menu. However, I could not find a way to emit a clicked() signal from the code to make the item selected into editing mode.

I used

QModelIndex index = this->ui_.tv_current_directory->currentIndex();
emit this->ui_.tv_current_directory->clicked( index );

where tv_current_directory is the QTreeView object. Obviously, VS2005 complains that I am trying to access the protected member of QAbstractItemView.

What should I do then? Thanks.

15th December 2008, 04:42
Solved. Using QTreeView edit() slot.