[ConfigModel] Emit dataChanged when a ConfigCategory changes
Differential Revision: https://phabricator.kde.org/D4543
This commit is contained in:
parent
cee709d054
commit
5becf5bc11
@ -135,6 +135,21 @@ void ConfigModelPrivate::appendCategory(ConfigCategory *c)
|
||||
{
|
||||
q->beginInsertRows(QModelIndex(), categories.size(), categories.size());
|
||||
categories.append(c);
|
||||
|
||||
auto emitChange = [this, c] {
|
||||
const int row = categories.indexOf(c);
|
||||
if (row > -1) {
|
||||
QModelIndex modelIndex = q->index(row);
|
||||
emit q->dataChanged(modelIndex, modelIndex);
|
||||
}
|
||||
};
|
||||
|
||||
QObject::connect(c, &ConfigCategory::nameChanged, q, emitChange);
|
||||
QObject::connect(c, &ConfigCategory::iconChanged, q, emitChange);
|
||||
QObject::connect(c, &ConfigCategory::sourceChanged, q, emitChange);
|
||||
QObject::connect(c, &ConfigCategory::pluginNameChanged, q, emitChange);
|
||||
QObject::connect(c, &ConfigCategory::visibleChanged, q, emitChange);
|
||||
|
||||
q->endInsertRows();
|
||||
emit q->countChanged();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user