Hi guys,
i'm trying to get a current selected row from a tableview so i can retrieve data from database edit them and update the database.i'm using QSqlTableModel and QTableView.
When i run my application and push the editButton the application always crush,what seem to be a problem ,please help me here is the slot which cause the problem.
Qt Code:
void customers::on_pushButton_2_clicked() { const QModelIndexList list = m_ui->customerView->selectionModel()->selection().indexes(); for (int i = 1; i < list.count(); i++) { int row = index.row(); rows.insert(index.row()); } qDebug() << row; QSqlQuery query; while (query.next()) { db_id = query.value(0).toInt(); db_LastName = query.value(1).toString(); db_FirstName = query.value(2).toString(); db_Category = query.value(3).toString(); db_Amount = query.value(4).toString(); } dialog = new newCustomer(this); dialog->editCustomer(db_LastName); int accepted = dialog->exec(); if(accepted == 1 ) { } }To copy to clipboard, switch view to plain text mode
Bookmarks