Commit fe44c73b authored by Alexander Volkov's avatar Alexander Volkov

Use lambda instead of QSignalMapper

Summary: QSignalMapper is obsolete and the code with lambda is shorter and clearer.

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D15289
parent a19a7115
......@@ -40,7 +40,6 @@
#include <QStyledItemDelegate>
#include <QPainter>
#include <QLineEdit>
#include <QSignalMapper>
#include <QToolTip>
#include <QAbstractItemModel>
#include <QDBusMetaType>
......@@ -369,17 +368,14 @@ KSysGuardProcessList::KSysGuardProcessList(QWidget* parent, const QString &hostN
d->mUi->treeView->sortByColumn(ProcessModel::HeadingUser, Qt::AscendingOrder);
// Add all the actions to the main widget, and get all the actions to call actionTriggered when clicked
QSignalMapper *signalMapper = new QSignalMapper(this);
QList<QAction *> actions;
actions << d->renice << d->kill << d->terminate << d->selectParent << d->selectTracer << d->window << d->jumpToSearchFilter;
actions << d->resume << d->sigStop << d->sigCont << d->sigHup << d->sigInt << d->sigTerm << d->sigKill << d->sigUsr1 << d->sigUsr2;
foreach(QAction *action, actions) {
addAction(action);
connect(action, SIGNAL(triggered(bool)), signalMapper, SLOT(map()));
signalMapper->setMapping(action, action);
connect(action, &QAction::triggered, this, [this, action]() { actionTriggered(action); });
}
connect(signalMapper, SIGNAL(mapped(QObject*)), SLOT(actionTriggered(QObject*)));
retranslateUi();
......
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