Commit d97d360b authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Use model reset rather than beginRemoveRows() to clear font groups

Summary:
Calling beginRemoveRows() when the model is empty hits an assert in
QAbstractItemModel which requires that the "last" argument is less
than model row count, which is not true when the model is empty.

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D11518
parent fe3db8ee
......@@ -523,8 +523,7 @@ void CGroupList::merge(const QString &file)
void CGroupList::clear()
{
beginRemoveRows(QModelIndex(), 0, itsGroups.count());
endRemoveRows();
beginResetModel();
itsGroups.removeFirst(); // Remove all
if(itsSpecialGroups[CGroupListItem::SYSTEM])
{
......@@ -542,6 +541,7 @@ void CGroupList::clear()
itsGroups.append(itsSpecialGroups[CGroupListItem::SYSTEM]);
}
// Dont add 'Unclassif' until we have some user groups
endResetModel();
}
QModelIndex CGroupList::index(CGroupListItem::EType t)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment