Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit a892a27e authored by Laurent Montel's avatar Laurent Montel

Add search line edit

parent 537946ce
......@@ -20,6 +20,7 @@
#include "customdebugsettingspagetest.h"
#include "../src/customdebugsettingspage.h"
#include <KListWidgetSearchLine>
#include <QLabel>
#include <QListWidget>
#include <QPushButton>
......@@ -48,6 +49,13 @@ void CustomDebugSettingsPageTest::shouldHaveDefaultValue()
QCOMPARE(listWidget->selectionMode(), QAbstractItemView::MultiSelection);
QCOMPARE(listWidget->count(), 0);
KListWidgetSearchLine *searchLine = page.findChild<KListWidgetSearchLine *>(QStringLiteral("searchline"));
QVERIFY(searchLine);
QVERIFY(!searchLine->placeholderText().isEmpty());
QCOMPARE(searchLine->listWidget(), listWidget);
QPushButton *addButton = page.findChild<QPushButton *>(QStringLiteral("add_rule"));
QVERIFY(addButton);
QVERIFY(addButton->isEnabled());
......
......@@ -22,6 +22,7 @@
#include "configurecustomsettingdialog.h"
#include "kdebugsettingsutil.h"
#include <KLocalizedString>
#include <KListWidgetSearchLine>
#include <KMessageBox>
#include <QVBoxLayout>
#include <QHBoxLayout>
......@@ -42,11 +43,16 @@ CustomDebugSettingsPage::CustomDebugSettingsPage(QWidget *parent)
lab->setObjectName(QStringLiteral("custom_label"));
vbox->addWidget(lab);
mListWidget = new QListWidget(this);
mListWidget->setObjectName(QStringLiteral("custom_listwidget"));
mListWidget->setSelectionMode(QAbstractItemView::MultiSelection);
connect(mListWidget, &QListWidget::itemSelectionChanged, this, &CustomDebugSettingsPage::updateButtons);
connect(mListWidget, &QListWidget::itemDoubleClicked, this, &CustomDebugSettingsPage::slotEditRule);
KListWidgetSearchLine *searchLine = new KListWidgetSearchLine(this, mListWidget);
searchLine->setObjectName(QStringLiteral("searchline"));
searchLine->setPlaceholderText(i18n("Search..."));
vbox->addWidget(searchLine);
vbox->addWidget(mListWidget);
QVBoxLayout *buttonLayout = new QVBoxLayout;
......@@ -114,7 +120,7 @@ void CustomDebugSettingsPage::fillList(const LoggingCategory::List &list)
}
}
LoggingCategory::List CustomDebugSettingsPage::rules()
LoggingCategory::List CustomDebugSettingsPage::rules() const
{
LoggingCategory::List lst;
const int number(mListWidget->count());
......
Markdown is supported
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