[utilities/kdebugsettings] src/widgets: Use new proxy model

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit ec2bbdb4bf8570615f733307eaa289107b1889f6 by Laurent Montel.
Committed on 19/07/2026 at 12:56.
Pushed by mlaurent into branch 'master'.

Use new proxy model

M  +2    -1    src/widgets/autotests/customdebuglistviewtest.cpp
M  +2    -2    src/widgets/customdebuglistview.cpp
M  +1    -1    src/widgets/customdebuglistview.h
M  +1    -1    src/widgets/customdebugsettingspage.cpp
M  +2    -1    src/widgets/tests/customdebuglistviewgui.cpp

https://invent.kde.org/utilities/kdebugsettings/-/commit/ec2bbdb4bf8570615f733307eaa289107b1889f6

diff --git a/src/widgets/autotests/customdebuglistviewtest.cpp b/src/widgets/autotests/customdebuglistviewtest.cpp
index 8a7ca43d..c53f04bf 100644
--- a/src/widgets/autotests/customdebuglistviewtest.cpp
+++ b/src/widgets/autotests/customdebuglistviewtest.cpp
@@ -6,6 +6,7 @@
 
 #include "customdebuglistviewtest.h"
 #include "customdebuglistview.h"
+#include "model/customloggingcategoryproxymodel.h"
 #include <QTest>
 
 QTEST_MAIN(CustomDebugListViewTest)
@@ -17,7 +18,7 @@ CustomDebugListViewTest::CustomDebugListViewTest(QObject *parent)
 
 void CustomDebugListViewTest::shouldHaveDefaultValues()
 {
-    CustomDebugListView w;
+    const CustomDebugListView w(new CustomLoggingCategoryProxyModel(this));
     QCOMPARE(w.contextMenuPolicy(), Qt::CustomContextMenu);
     QCOMPARE(w.selectionMode(), QAbstractItemView::ExtendedSelection);
 }
diff --git a/src/widgets/customdebuglistview.cpp b/src/widgets/customdebuglistview.cpp
index 25dbd740..f79dd3ff 100644
--- a/src/widgets/customdebuglistview.cpp
+++ b/src/widgets/customdebuglistview.cpp
@@ -21,9 +21,9 @@
 #include <QPointer>
 
 using namespace Qt::Literals::StringLiterals;
-CustomDebugListView::CustomDebugListView(QWidget *parent)
+CustomDebugListView::CustomDebugListView(CustomLoggingCategoryProxyModel *proxyModel, QWidget *parent)
     : QListView(parent)
-    , mCustomLoggingCategoryProxyModel(new CustomLoggingCategoryProxyModel(this))
+    , mCustomLoggingCategoryProxyModel(proxyModel)
 {
     mCustomLoggingCategoryProxyModel->setObjectName("mCustomDebugProxyModel"_L1);
     setContextMenuPolicy(Qt::CustomContextMenu);
diff --git a/src/widgets/customdebuglistview.h b/src/widgets/customdebuglistview.h
index be0ac045..f7140f51 100644
--- a/src/widgets/customdebuglistview.h
+++ b/src/widgets/customdebuglistview.h
@@ -14,7 +14,7 @@ class LIBKDEBUGSETTINGS_EXPORT_TEST_EXPORT CustomDebugListView : public QListVie
 {
     Q_OBJECT
 public:
-    explicit CustomDebugListView(QWidget *parent = nullptr);
+    explicit CustomDebugListView(CustomLoggingCategoryProxyModel *proxyModel, QWidget *parent = nullptr);
     ~CustomDebugListView() override;
 
     void slotAddRule();
diff --git a/src/widgets/customdebugsettingspage.cpp b/src/widgets/customdebugsettingspage.cpp
index 2c89dda5..4d5d3382 100644
--- a/src/widgets/customdebugsettingspage.cpp
+++ b/src/widgets/customdebugsettingspage.cpp
@@ -23,7 +23,7 @@ CustomDebugSettingsPage::CustomDebugSettingsPage(QWidget *parent)
     , mEditRule(new QPushButton(i18nc("@action:button", "Edit…"), this))
     , mRemoveRule(new QPushButton(i18nc("@action:button", "Remove…"), this))
     , mSearchLineEdit(new QLineEdit(this))
-    , mCustomDebugListView(new CustomDebugListView(this))
+    , mCustomDebugListView(new CustomDebugListView(LoggingManager::self().customLoggingCategoryProxyModel(), this))
 {
     auto mainLayout = new QVBoxLayout(this);
 
diff --git a/src/widgets/tests/customdebuglistviewgui.cpp b/src/widgets/tests/customdebuglistviewgui.cpp
index 636a19eb..5ed1354b 100644
--- a/src/widgets/tests/customdebuglistviewgui.cpp
+++ b/src/widgets/tests/customdebuglistviewgui.cpp
@@ -6,6 +6,7 @@
 */
 
 #include "customdebuglistviewgui.h"
+#include "model/customloggingcategoryproxymodel.h"
 using namespace Qt::Literals::StringLiterals;
 
 #include "customdebuglistview.h"
@@ -18,7 +19,7 @@ CustomDebugListViewGui::CustomDebugListViewGui(QWidget *parent)
     : QWidget{parent}
 {
     auto vboxLayout = new QVBoxLayout(this);
-    auto view = new CustomDebugListView(this);
+    auto view = new CustomDebugListView(new CustomLoggingCategoryProxyModel(this), this);
 
     LoggingCategory::List lst;
     for (int i = 0; i < 5; ++i) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.