Skip to content

Commit c951c1c

Browse files
committed
Fix filter row losing focus when changing filter values
This was introduced in 6f49905.
1 parent 88ca9fa commit c951c1c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/sqlitetablemodel.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void SqliteTableModel::handleRowCountComplete (int life_id, int num_rows)
118118
void SqliteTableModel::reset()
119119
{
120120
beginResetModel();
121-
clearCache();
121+
m_cache.clear();
122122

123123
m_sQuery.clear();
124124
m_query.clear();
@@ -851,8 +851,14 @@ void SqliteTableModel::clearCache()
851851
endRemoveRows();
852852
}
853853

854+
// We want to clear the cache contents here but keep the initialised flag.
855+
// This is a bit hacky but the easiest way to achieve this. In the long term
856+
// we might want to change this whole concept of clearing and resetting.
857+
const bool cache_initialised = m_cache.initialised();
854858
m_cache.clear();
855-
m_headers.clear();
859+
if(cache_initialised)
860+
m_cache.setInitialised();
861+
856862
m_currentRowCount = 0;
857863
m_rowCountAvailable = RowCount::Unknown;
858864
}

0 commit comments

Comments
 (0)