Fix AppLogController to activate changes immediately

This commit is contained in:
Michael Zanetti 2021-03-16 22:17:01 +01:00
parent b4bdcf635b
commit 5c1d7b5790
2 changed files with 11 additions and 1 deletions

View File

@ -148,6 +148,8 @@ void AppLogController::setLogLevel(const QString &category, AppLogController::Lo
settings.endGroup();
emit categoryChanged(category, logLevel);
updateFilters();
}
QString AppLogController::logPath() const
@ -378,3 +380,8 @@ QHash<int, QByteArray> LoggingCategories::roleNames() const
return roles;
}
QVariant LoggingCategories::data(int index, const QString &role)
{
return data(this->index(index), roleNames().key(role.toUtf8()));
}

View File

@ -135,6 +135,7 @@ private:
class LoggingCategories: public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(int count READ rowCount CONSTANT)
public:
enum Roles {
@ -145,10 +146,12 @@ public:
LoggingCategories(AppLogController *parent);
int rowCount(const QModelIndex &parent) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const override;
QHash<int, QByteArray> roleNames() const override;
Q_INVOKABLE QVariant data(int index, const QString &role);
private:
AppLogController *m_controller = nullptr;
};