tags:

views:

28

answers:

1

I have a QTreeView with data that changes over time, with a dataChanged signal being emitted in the QAbstractItemModel every second. The items in the QTreeView can be edited as well, but when a editor is opened for a certain item the editor string is updated while I edit is, which is very annoying. Any way to prevent an editor to be updated with the new values?

+1  A: 

Do you use your own model with QTreeView? In this case you overwrite it and not return any data for Qt::EditRole. If it is not convenient for you (you want to have the current data in the field when you begin to edit it), then you could create your own QItemDelegate/QStyledItemDelegate and implement some custom logic there: make it so the widget is not updated with new value, when it has focus, for example.

Althought I might be missing something, and there is an easier way to do this.

ak
how could I prevent the update in case the delegate has the focus? simply overriding update() would prevent my input to be displayed while I type the value, wouldn't it?
Fabian Wickborn
ak
works like a charms, thanks 1.0e6
Fabian Wickborn