Thank you for replying. Line 51 modified :P
I tried calling the reset but nothing changes. Rows showed change to 256 after the edit.
There is no selection, the user only changes the value of one cell so i think i dont have to iterate, right? So i call setData() from the index of interest but still the same, rows trim to 256.
void WidgetModificacion
::actualizar_fecha (int row,
QSqlRecord & record
){ if (tipo_tabla == 0){
query.prepare("UPDATE TABLE_PRODUCTOS SET fecha_modificacion = SYSDATE WHERE id_codigo_barra = :value");
query.bindValue (":value", this->ui->tableView->model ()->data (this->ui->tableView->model ()->index (row, 0)).toString ());
query.exec ();
}
//ui->tableView->reset();
model
->setData
(model
->index
(row,
5),
QDateTime::currentDateTime().
toString(),Qt
::DisplayRole);
while (model->canFetchMore())model->fetchMore();
}
void WidgetModificacion::actualizar_fecha (int row, QSqlRecord & record){
if (tipo_tabla == 0){
QSqlQuery query = QSqlQuery (db);
query.prepare("UPDATE TABLE_PRODUCTOS SET fecha_modificacion = SYSDATE WHERE id_codigo_barra = :value");
query.bindValue (":value", this->ui->tableView->model ()->data (this->ui->tableView->model ()->index (row, 0)).toString ());
query.exec ();
}
//ui->tableView->reset();
model->setData(model->index(row,5), QDateTime::currentDateTime().toString(),Qt::DisplayRole);
while (model->canFetchMore())model->fetchMore();
}
To copy to clipboard, switch view to plain text mode
The value is always updated after edit and i can see that value modified but rows set to 256 anyways.
Bookmarks