What does an editable finished QTableView element mean?

I want to know when the user has finished editing the QTableView element, so I checked all the available signals, but I found only those that will be issued before editing.

So what should I do now?

Running Qt 4.8.4

+4
source share
2 answers

Since your QTableView will connect the model, connect to its signals,

for example, void QStandardItemModel :: itemChanged (QStandardItem * element) [signal]

or, more generally:

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

You can also connect to the selection model .
Usually, when you finish editing an element, focus on the following, so that the currentChanged selection mode will be selected, but this should not be general.

+5
source

The true signal of finished editing you can find only in QAbstractItemDelegate . This is the signal closeEditor() . All other signals from the models will not work if the user does not change anything in the cell, but the delegate closes every time when editing is completed. As the doc said:

This signal is emitted when the user has finished editing the element using the specified editor.

The tooltip allows the delegate to influence how the model and view will be performed after editing is completed. He indicates these actions that should be taken to provide convenient editing for the user. For example, if EditNextItem is specified, the view must use a delegate to open the editor for the next element in the model.

Using:

 connect(ui->tableView->itemDelegate(),SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)),SLOT(someSlot())); 
+3
source

All Articles