Quote Originally Posted by deepakn View Post
QString QDirModel::filePath ( const QModelIndex & index ) const [/CODE] does it, but I am not able to supply the index value of the currently selected item. How do I do it?
Lets say you want to do something when someone double clicks on any file in tree view.
You need to connect the
Qt Code:
  1. void doubleClicked ( const QModelIndex & index )
To copy to clipboard, switch view to plain text mode 
SIGNAL of the QTreeView.
To your custom SLOT.
In that slot, you can get the filePath easily because you have the QModelIndex with you.
By calling
Qt Code:
  1. QString QDirModel::fileName ( const QModelIndex & index ) const
To copy to clipboard, switch view to plain text mode