chore(StatusQ/TestLib): TestModel::resetAndClear method added

This commit is contained in:
Michał Cieślak 2024-07-01 12:54:34 +02:00 committed by Michał
parent b005a5606e
commit 05b47fb831
2 changed files with 12 additions and 0 deletions

View File

@ -134,6 +134,15 @@ void TestModel::reset()
endResetModel(); endResetModel();
} }
void TestModel::resetAndClear()
{
beginResetModel();
std::for_each(m_data.begin(), m_data.end(), [](auto& e) {
e.second.clear();
});
endResetModel();
}
void TestModel::initRoles() void TestModel::initRoles()
{ {
m_roles.reserve(m_data.size()); m_roles.reserve(m_data.size());

View File

@ -29,6 +29,9 @@ public:
// emits modelAboutToBeReset/modelReset, content remains the same // emits modelAboutToBeReset/modelReset, content remains the same
void reset(); void reset();
// emits modelAboutToBeReset/modelReset, content is removed
void resetAndClear();
private: private:
void initRoles(); void initRoles();