Commit a0a6019b authored by Laurent Montel's avatar Laurent Montel 😁

Use trapReturnKey

parent 69805149
......@@ -17,6 +17,7 @@ find_package(KF5 REQUIRED COMPONENTS
IconThemes
WidgetsAddons
ItemViews
Completion
KIO)
include(FeatureSummary)
......
......@@ -23,6 +23,7 @@ macro(add_unittest _source _additionalsource)
KF5::ConfigCore
KF5::WidgetsAddons
KF5::ItemViews
KF5::Completion
)
endmacro ()
......
......@@ -22,7 +22,7 @@
#include "../src/configurecustomsettingwidget.h"
#include <QComboBox>
#include <QLabel>
#include <QLineEdit>
#include <KLineEdit>
#include <QSignalSpy>
#include <qcheckbox.h>
#include <qtest.h>
......@@ -44,8 +44,9 @@ void ConfigureCustomSettingWidgetTest::shouldHaveDefaultValue()
QLabel *lab = w.findChild<QLabel *>(QStringLiteral("category_label"));
QVERIFY(lab);
QLineEdit *categoryLineEdit = w.findChild<QLineEdit *>(QStringLiteral("category_lineedit"));
KLineEdit *categoryLineEdit = w.findChild<KLineEdit *>(QStringLiteral("category_lineedit"));
QVERIFY(categoryLineEdit);
QVERIFY(categoryLineEdit->trapReturnKey());
QCheckBox *enableCategory = w.findChild<QCheckBox *>(QStringLiteral("enable_category"));
QVERIFY(enableCategory);
......@@ -79,7 +80,7 @@ void ConfigureCustomSettingWidgetTest::shouldRestoreRules()
void ConfigureCustomSettingWidgetTest::shouldEmitSignalWhenWeChangeLogName()
{
ConfigureCustomSettingWidget w;
QLineEdit *categoryLineEdit = w.findChild<QLineEdit *>(QStringLiteral("category_lineedit"));
KLineEdit *categoryLineEdit = w.findChild<KLineEdit *>(QStringLiteral("category_lineedit"));
QVERIFY(categoryLineEdit);
QSignalSpy spy(&w, SIGNAL(enableButton(bool)));
categoryLineEdit->setText(QStringLiteral("bla"));
......
......@@ -11,7 +11,7 @@ set(kdebugsettings_SRCS
add_executable(kdebugsettings ${kdebugsettings_SRCS})
target_link_libraries(kdebugsettings Qt5::Widgets KF5::I18n KF5::DBusAddons KF5::CoreAddons KF5::ConfigCore KF5::WidgetsAddons KF5::ItemViews)
target_link_libraries(kdebugsettings Qt5::Widgets KF5::I18n KF5::DBusAddons KF5::CoreAddons KF5::ConfigCore KF5::WidgetsAddons KF5::ItemViews KF5::Completion)
install(TARGETS kdebugsettings ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
......
......@@ -23,7 +23,7 @@
#include "kdebugsettingsutil.h"
#include <KLocalizedString>
#include <QLabel>
#include <QLineEdit>
#include <KLineEdit>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QCheckBox>
......@@ -37,9 +37,10 @@ ConfigureCustomSettingWidget::ConfigureCustomSettingWidget(QWidget *parent)
QLabel *lab = new QLabel(i18n("Category:"));
lab->setObjectName(QStringLiteral("category_label"));
mCategoryLineEdit = new QLineEdit;
mCategoryLineEdit = new KLineEdit;
mCategoryLineEdit->setTrapReturnKey(true);
mCategoryLineEdit->setObjectName(QStringLiteral("category_lineedit"));
connect(mCategoryLineEdit, &QLineEdit::textChanged, this, &ConfigureCustomSettingWidget::slotTextChanged);
connect(mCategoryLineEdit, &KLineEdit::textChanged, this, &ConfigureCustomSettingWidget::slotTextChanged);
QHBoxLayout *categoryLayout = new QHBoxLayout;
vbox->addLayout(categoryLayout);
categoryLayout->addWidget(lab);
......
......@@ -22,7 +22,7 @@
#define CONFIGURECUSTOMSETTINGWIDGET_H
#include <QWidget>
class QLineEdit;
class KLineEdit;
class QCheckBox;
class QComboBox;
class ConfigureCustomSettingWidget : public QWidget
......@@ -42,7 +42,7 @@ private Q_SLOTS:
void slotTextChanged(const QString &);
private:
QLineEdit *mCategoryLineEdit;
KLineEdit *mCategoryLineEdit;
QCheckBox *mEnableCategory;
QComboBox *mCategoryType;
};
......
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