[Qt-interest] Editable QTreeView / QAbstractItemModel

Georg Grabler ggrabler at gmail.com
Thu Apr 30 21:43:23 CEST 2009


Hello,

I'd like to implement an editable QTreeView with a subclassed
QAbstractItemModel as a data provider.

Now, I can do so. I have a QTreeView, which actually is editable. For the
"better" user experience, I'd like to do the following:
If the user double clicks an item, it switches to edit mode (done so far,
works by reimplementing setData and flags).
I'd like the text in the column of the TreeView to be persistent on double
click, means - the text in there isn't changed, but selected. By default,
the Model / View deletes the text in the box.
How can I make the view / model to keep the text until the user deletes it?
Of course, by pressing escape, the text is still there (cancel edit).

Any hints on that?

Kind regards,
Georg

PS: I took the example of Model / View programming 1:1 for this, but I
havn't found a possibility to keep the data which was in there before.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090430/dbade9da/attachment.html 


More information about the Qt-interest-old mailing list