Hi wysota,
I know what should do insertRow(); removeRow(); and updateRowInTable();
But i dont know how to use it.
With this code i am able to view the values of my table:
QString table
= ui.
tabelle_le->text
();
model->setTable(table);
model->select();
ui.tableView->setModel(model);
ui.tableView->show();
QString table = ui.tabelle_le->text();
QSqlTableModel *model = new QSqlTableModel;
model->setTable(table);
model->setEditStrategy(QSqlTableModel::OnManualSubmit);
model->select();
ui.tableView->setModel(model);
ui.tableView->show();
To copy to clipboard, switch view to plain text mode
And now i would like to insert a new Row or update a value or delete a Row.
And my problem is:
How to use:
bool QAbstractItemModel::insertRow ( int row, const QModelIndex & parent = QModelIndex() )
bool QAbstractItemModel::removeRow ( int row, const QModelIndex & parent = QModelIndex() )
I have not found any examples how to use it.
In the passt i use this for create a new row:
insert.exec()..
..
QSqlQuery insert("insert into.....");
insert.exec()..
..
To copy to clipboard, switch view to plain text mode
I would like to use :
bool QAbstractItemModel::insertRow ( int row, const QModelIndex & parent = QModelIndex() )
bool QAbstractItemModel::removeRow ( int row, const QModelIndex & parent = QModelIndex() )
To copy to clipboard, switch view to plain text mode
Can somebody show me how to use it?
Bookmarks