PDA

View Full Version : QTreeView and item editing



roxton
24th July 2008, 23:42
I have a QTreeView with an editable QDirModel. How can I detect when user ends an item editing (rename)? (I need to update some stuff after that)
And another question - is there someway to catch the Delete key pressing on QTreeView (without a subclassing)?

aamer4yu
25th July 2008, 06:36
I have a QTreeView with an editable QDirModel. How can I detect when user ends an item editing (rename)? (I need to update some stuff after that)
Am not sure about it,,, but I guess QItemDelegate::setModelData is the function for you :)

And another question - is there someway to catch the Delete key pressing on QTreeView (without a subclassing)?
Yess,,, install a event filter on the QTreeView - Refer QObject::installEventFilter

Hope this helps :)

roxton
25th July 2008, 12:00
Thank you! And about the QItemDelegate::setModelData - I've used a commitData signal from QItemDelegate.

aamer4yu
25th July 2008, 19:56
Ya, commitData was the signal, I remembered somewhat abt it but was not able to locate it :(