What's the "editing finished" signal of a QTableView item?

daisy picture daisy · Apr 29, 2013 · Viewed 7k times · Source

I want to know when user has finished editing a QTableView item, so I checked all the available signals, but I only found ones that will emit before the edit.

So, what should I do now?

Running Qt 4.8.4

Answer

trompa picture trompa · Apr 29, 2013

Since your QTableView will have attached a model, connect to its signals,

eg void QStandardItemModel::itemChanged ( QStandardItem * item ) [signal]

or, more generally:

void QAbstractItemModel::dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight )

You can, also, connect to the selection model signals.
Usually, when you finish editing an item, focus changes to next, so selectionmodel will fire currentChanged but this hasnt to be general.