Yes, the timer did the trick. This is how it is working now, including the new slot:
...
if (act == iActionAddValue) {
iTable->clearSelection();
model->insertRow(model->rowCount());
iTable->resizeRowsToContents();
QTimer::singleShot(0,
this,
SLOT(scrollAndEdit
()));
} // if
...
void AMainWindow::scrollAndEdit() // declared as private slot
{
QModelIndex index
(model
->index
(model
->rowCount
()-1,
0));
iTable->scrollTo(index);
iTable->edit(index);
} // scrollAndEdit
...
if (act == iActionAddValue) {
iTable->clearSelection();
QAbstractItemModel* model = iTable->model();
model->insertRow(model->rowCount());
iTable->resizeRowsToContents();
QTimer::singleShot(0, this, SLOT(scrollAndEdit()));
} // if
...
void AMainWindow::scrollAndEdit() // declared as private slot
{
QAbstractItemModel* model = iTable->model();
QModelIndex index(model->index(model->rowCount()-1,0));
iTable->scrollTo(index);
iTable->edit(index);
} // scrollAndEdit
To copy to clipboard, switch view to plain text mode
Well surely not an elegant solution, but at least a workaround. I wonder if there is a more convenient way to let the pending events be consumed between two statements.
Bookmarks