QListView loses data when QSqlTableModel submitAll() is called
-
Hey,
I have QSortFilterProxyModel in a QListView:
//mGermanFungusNameFilter = QSortFilterProxyModel //mGermanNames = QSqlTableModel //mGermanNameEditor = QListView mGermanNameFilter->setSourceModel(mGermanNames); mGermanNameEditor->setModel(mGermanNameFilter); mGermanNameEditor->setModelColumn(1);If I have edited (updated) the data and then call
mGermanNames->submitAll()via a QPushButton, all data disappears from the QListView.What have I forgotten? Can't QStyledItemDelegate handle a QSortFilterProxyModel? Or how do I write the data from a QSortFilerProxyModel back to the database (SQLITE)?
Thanks for your help!
-
Hey,
I have QSortFilterProxyModel in a QListView:
//mGermanFungusNameFilter = QSortFilterProxyModel //mGermanNames = QSqlTableModel //mGermanNameEditor = QListView mGermanNameFilter->setSourceModel(mGermanNames); mGermanNameEditor->setModel(mGermanNameFilter); mGermanNameEditor->setModelColumn(1);If I have edited (updated) the data and then call
mGermanNames->submitAll()via a QPushButton, all data disappears from the QListView.What have I forgotten? Can't QStyledItemDelegate handle a QSortFilterProxyModel? Or how do I write the data from a QSortFilerProxyModel back to the database (SQLITE)?
Thanks for your help!
@Gabber
bool QSqlTableModel::submitAll():In
OnManualSubmit, on success the model will be repopulated. Any views presenting it will lose their selections.I presume you are using OMS. Check
submitAll()succeeded. Check data got re-read. Check how many rows in SQL source model now. Check what filter is in QSFPM. Check how many rows that has. Check what yourQListViewis attached to, and how many rows it has. Check QSFPM is still accessing QSTM, it should not need it but you can always do a refresh to make sure. Find out where issue lies between QSTM, QSFPM & QLV! -
@JonB said in QListView loses data when QSqlTableModel submitAll() is called:
I presume you are using OMS
Yes, you are right.
The model had only 256 rows. With canFetchMore() and fetchMore() after submitAll() it works now.
When I double click on the selected item I only have a small edit window (see picture). Is it possible to extend this to the whole length (like the blue bar)? And also adjust the height because part of the font is cut off....
