I need to finish edit QTableWidget when some event happend.
MyWindow::onSomeEvent
{
// Finish ui->table editing
//...
}
How can I do this?
The event is a spinbox editing. When it happend rows count becomes equled its value.
I tried to send enter key press event. But when editing item in the last row and new rows count is less then current it does not work.
QKeyEvent *ev = new QKeyEvent(QEvent::KeyRelease,
Qt::Key_Return,
Qt::NoModifier);
QApplication::sendEvent(ui->table, ev);
ui->table->setRowCount(value);
QApplication::sendEvent(ui->table, ev);