[Qt 4.1.0, windows]
In a QTableView I want to add a new row at the end, scroll to it and open the first column for editing. However it only scrolls down to the second last row (the one that was the last one before the new row was added). The new row remains outside of visibility. I have also tried with scrollToBottom(), but exactly the same.
if (act == iActionAddValue) {
ALocalvalueModel* model = (ALocalvalueModel*)iTable->model();
model->insertRow(model->rowCount());
iTable->resizeRowsToContents();
iTable->clearSelection();
QModelIndex index
(model
->index
(model
->rowCount
()-1,
0));
iTable->scrollTo(index);
iTable->edit(index);
} // if
if (act == iActionAddValue) {
ALocalvalueModel* model = (ALocalvalueModel*)iTable->model();
model->insertRow(model->rowCount());
iTable->resizeRowsToContents();
iTable->clearSelection();
QModelIndex index(model->index(model->rowCount()-1,0));
iTable->scrollTo(index);
iTable->edit(index);
} // if
To copy to clipboard, switch view to plain text mode
Bookmarks