[utilities/kdebugsettings] src/core: Update ok/apply button
Laurent Montel <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 36149d61f90a8d701352fdafed812502cb967592 by Laurent Montel.
Committed on 31/07/2026 at 05:12.
Pushed by mlaurent into branch 'master'.
Update ok/apply button
M +13 -1 src/core/loggingmanager.cpp
M +1 -7 src/core/model/customloggingcategorymodel.cpp
M +0 -3 src/core/model/customloggingcategorymodel.h
M +1 -1 src/core/model/kdeapplicationloggingcategorymodel.cpp
https://invent.kde.org/utilities/kdebugsettings/-/commit/36149d61f90a8d701352fdafed812502cb967592
diff --git a/src/core/loggingmanager.cpp b/src/core/loggingmanager.cpp
index 0a33bafc..4ca3e6ae 100644
--- a/src/core/loggingmanager.cpp
+++ b/src/core/loggingmanager.cpp
@@ -21,7 +21,19 @@ LoggingManager::LoggingManager(QObject *parent)
mCustomLoggingCategoryProxyModel->setSourceModel(mCustomCategoryModel);
mLoggings.readQtLoggingFile();
updateLoggingCategories();
- connect(mCustomCategoryModel, &CustomLoggingCategoryModel::customLoggingChanged, this, &LoggingManager::customLoggingChanged);
+
+ connect(mCustomCategoryModel, &QAbstractItemModel::rowsInserted, this, &LoggingManager::customLoggingChanged);
+ connect(mCustomCategoryModel, &QAbstractItemModel::rowsRemoved, this, &LoggingManager::customLoggingChanged);
+ connect(mCustomCategoryModel, &QAbstractItemModel::dataChanged, this, &LoggingManager::customLoggingChanged);
+
+ connect(mQtKdeCategoryModel,
+ &QAbstractItemModel::dataChanged,
+ this,
+ [this]([[maybe_unused]] const QModelIndex &topLeft, [[maybe_unused]] const QModelIndex &, const QList<int> &roles) {
+ if (roles.contains(KDEApplicationLoggingCategoryModel::LoggingTypeRole)) {
+ Q_EMIT customLoggingChanged();
+ }
+ });
}
CustomLoggingCategoryProxyModel *LoggingManager::customLoggingCategoryProxyModel() const
diff --git a/src/core/model/customloggingcategorymodel.cpp b/src/core/model/customloggingcategorymodel.cpp
index 071c137d..5988de2a 100644
--- a/src/core/model/customloggingcategorymodel.cpp
+++ b/src/core/model/customloggingcategorymodel.cpp
@@ -73,7 +73,6 @@ void CustomLoggingCategoryModel::updateCategory(int row, const QString &category
cat.loggingType = type;
const QModelIndex modelIndex = index(row, 0);
Q_EMIT dataChanged(modelIndex, modelIndex);
- Q_EMIT customLoggingChanged();
}
QVariant CustomLoggingCategoryModel::data(const QModelIndex &index, int role) const
@@ -131,7 +130,6 @@ void CustomLoggingCategoryModel::removeCategory(int row)
beginRemoveRows(QModelIndex(), row, row);
mLoggingCategories.removeAt(row);
endRemoveRows();
- Q_EMIT customLoggingChanged();
}
void CustomLoggingCategoryModel::removeCategory(const LoggingCategory::List &categories)
@@ -146,7 +144,6 @@ void CustomLoggingCategoryModel::removeCategory(const LoggingCategory::List &cat
}
}
endResetModel();
- Q_EMIT customLoggingChanged();
}
void CustomLoggingCategoryModel::addCategory(const QString &categoryName, bool enabled, LoggingCategory::LoggingType type)
@@ -155,9 +152,7 @@ void CustomLoggingCategoryModel::addCategory(const QString &categoryName, bool e
category.categoryName = categoryName;
category.enabled = enabled;
category.loggingType = type;
- if (addCategory(category)) {
- Q_EMIT customLoggingChanged();
- }
+ if (addCategory(category)) { }
}
bool CustomLoggingCategoryModel::addCategory(const LoggingCategory &category)
@@ -189,7 +184,6 @@ void CustomLoggingCategoryModel::insertCategories(const LoggingCategory::List &c
beginInsertRows(QModelIndex(), mLoggingCategories.count(), mLoggingCategories.count() + categories.count() - 1);
mLoggingCategories.append(categories);
endInsertRows();
- Q_EMIT customLoggingChanged();
}
}
diff --git a/src/core/model/customloggingcategorymodel.h b/src/core/model/customloggingcategorymodel.h
index 229a0bf4..50b7f606 100644
--- a/src/core/model/customloggingcategorymodel.h
+++ b/src/core/model/customloggingcategorymodel.h
@@ -54,9 +54,6 @@ public:
Q_INVOKABLE void addCategory(const QString &categoryName, bool enabled, LoggingCategory::LoggingType type);
Q_INVOKABLE void updateCategory(int row, const QString &categoryName, bool enabled, LoggingCategory::LoggingType type);
-Q_SIGNALS:
- void customLoggingChanged();
-
private:
LoggingCategory::List mLoggingCategories;
QHash<int, QByteArray> mRoleNames;
diff --git a/src/core/model/kdeapplicationloggingcategorymodel.cpp b/src/core/model/kdeapplicationloggingcategorymodel.cpp
index 95ff81a4..068a843d 100644
--- a/src/core/model/kdeapplicationloggingcategorymodel.cpp
+++ b/src/core/model/kdeapplicationloggingcategorymodel.cpp
@@ -96,7 +96,7 @@ bool KDEApplicationLoggingCategoryModel::setData(const QModelIndex &modelIndex,
cat.loggingType = value.value<LoggingCategory::LoggingType>();
const QModelIndex topLeft = index(modelIndex.row(), LoggingTypeRole);
const QModelIndex bottomRight = index(modelIndex.row(), LoggingTypeStrRole);
- Q_EMIT dataChanged(topLeft, bottomRight);
+ Q_EMIT dataChanged(topLeft, bottomRight, {LoggingTypeRole});
return true;
}
default: