mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
SqliteTableModel: Notify view and parent class code when clearing cache
Call beginRemoveRows() and endRemoveRows() when emptying the cache. This silences those warnings from QAbstractItemModel::endInsertRows() and fixes a crash when exiting the program both ocurring when the data was resorted.
This commit is contained in:
@@ -58,7 +58,7 @@ void SqliteTableModel::setQuery(const QString& sQuery)
|
||||
sqlite3_finalize(stmt);
|
||||
|
||||
// now fetch the first entries
|
||||
m_data.clear();
|
||||
clearCache();
|
||||
fetchData(0, m_chunkSize);
|
||||
|
||||
emit layoutChanged();
|
||||
@@ -282,3 +282,10 @@ void SqliteTableModel::updateFilter(int column, const QString& value)
|
||||
// Build the new query
|
||||
buildQuery();
|
||||
}
|
||||
|
||||
void SqliteTableModel::clearCache()
|
||||
{
|
||||
beginRemoveRows(QModelIndex(), 0, m_data.size()-1);
|
||||
m_data.clear();
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public slots:
|
||||
|
||||
private:
|
||||
void fetchData(unsigned int from, unsigned to);
|
||||
void clearCache();
|
||||
|
||||
void buildQuery();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user