View Full Version : "setIndexWidget" is a bad way ?

31st May 2014, 21:46
Hi all,
I have a QTreeView with 2 column name and editor.
I used QItemDelegate, but the problem is the editor is not always visible, you have to click one time.
I already know the way "reimplement paint()" but you have to enable the cell.
I saw in documentation this function : setIndexWidget, is it safe to use it ?
My goal is to have the widget always visible never has to enable it.
Thanks for the help.
EDIT: Maybe I have bad understand really and using this function will give me the same result I got with paint() ?

31st May 2014, 21:57
Are you looking for QAbstractItemView::openPersistentEditor()?


1st June 2014, 03:23
This function to be nicely used has to be used on this way :
1) Add Item in tree
2) After added call this function with the index where the item is added
Is it correct ?
But since the QTreeView allow to have acces to model, if an item is added without this function, that will not work.
But ... then it's an human error surely ...
At the end it's like setIndexWidget ?
I wait your answer to be sure.
EDIT: maybe QTreeView is not what I should use, QTableWidget is a better choice ?