PDA

View Full Version : QTreeView - persistentEditor or delegates



moti.lahiani
23rd July 2009, 15:19
Hi all
I have QTreeView implementation as QMyTreeView
to this tree i have contextMenu with action "rename"
when user choose rename the action call to my method


StartEditing(QModelIndex& indx)
{
this->openPersistentEditor(indx);
}
and i reimplemented the slot


currentChanged (QModelIndex& current, QModelIndex& previous)
{
if(current!=previous)
{
//here i want to get the new text the user write before commitData
this->closePersistentEditor(previous);
}
}

what i need to do is to get the new text user enter and check it before commit it.
How can i do it? how can i get the text?
should i need to use delegate? how ? example will help?
thanks alot