Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
KDebugSettings
Commits
a0a6019b
Commit
a0a6019b
authored
Mar 05, 2015
by
Laurent Montel
😁
Browse files
Use trapReturnKey
parent
69805149
Changes
6
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
a0a6019b
...
...
@@ -17,6 +17,7 @@ find_package(KF5 REQUIRED COMPONENTS
IconThemes
WidgetsAddons
ItemViews
Completion
KIO
)
include
(
FeatureSummary
)
...
...
autotests/CMakeLists.txt
View file @
a0a6019b
...
...
@@ -23,6 +23,7 @@ macro(add_unittest _source _additionalsource)
KF5::ConfigCore
KF5::WidgetsAddons
KF5::ItemViews
KF5::Completion
)
endmacro
()
...
...
autotests/configurecustomsettingwidgettest.cpp
View file @
a0a6019b
...
...
@@ -22,7 +22,7 @@
#include "../src/configurecustomsettingwidget.h"
#include <QComboBox>
#include <QLabel>
#include <
Q
LineEdit>
#include <
K
LineEdit>
#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
);
Q
LineEdit
*
categoryLineEdit
=
w
.
findChild
<
Q
LineEdit
*>
(
QStringLiteral
(
"category_lineedit"
));
K
LineEdit
*
categoryLineEdit
=
w
.
findChild
<
K
LineEdit
*>
(
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
;
Q
LineEdit
*
categoryLineEdit
=
w
.
findChild
<
Q
LineEdit
*>
(
QStringLiteral
(
"category_lineedit"
));
K
LineEdit
*
categoryLineEdit
=
w
.
findChild
<
K
LineEdit
*>
(
QStringLiteral
(
"category_lineedit"
));
QVERIFY
(
categoryLineEdit
);
QSignalSpy
spy
(
&
w
,
SIGNAL
(
enableButton
(
bool
)));
categoryLineEdit
->
setText
(
QStringLiteral
(
"bla"
));
...
...
src/CMakeLists.txt
View file @
a0a6019b
...
...
@@ -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
}
)
...
...
src/configurecustomsettingwidget.cpp
View file @
a0a6019b
...
...
@@ -23,7 +23,7 @@
#include "kdebugsettingsutil.h"
#include <KLocalizedString>
#include <QLabel>
#include <
Q
LineEdit>
#include <
K
LineEdit>
#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
,
&
Q
LineEdit
::
textChanged
,
this
,
&
ConfigureCustomSettingWidget
::
slotTextChanged
);
connect
(
mCategoryLineEdit
,
&
K
LineEdit
::
textChanged
,
this
,
&
ConfigureCustomSettingWidget
::
slotTextChanged
);
QHBoxLayout
*
categoryLayout
=
new
QHBoxLayout
;
vbox
->
addLayout
(
categoryLayout
);
categoryLayout
->
addWidget
(
lab
);
...
...
src/configurecustomsettingwidget.h
View file @
a0a6019b
...
...
@@ -22,7 +22,7 @@
#define CONFIGURECUSTOMSETTINGWIDGET_H
#include <QWidget>
class
Q
LineEdit
;
class
K
LineEdit
;
class
QCheckBox
;
class
QComboBox
;
class
ConfigureCustomSettingWidget
:
public
QWidget
...
...
@@ -42,7 +42,7 @@ private Q_SLOTS:
void
slotTextChanged
(
const
QString
&
);
private:
Q
LineEdit
*
mCategoryLineEdit
;
K
LineEdit
*
mCategoryLineEdit
;
QCheckBox
*
mEnableCategory
;
QComboBox
*
mCategoryType
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment