diff --git a/processui/ksysguardprocesslist.h b/processui/ksysguardprocesslist.h --- a/processui/ksysguardprocesslist.h +++ b/processui/ksysguardprocesslist.h @@ -208,7 +208,7 @@ void filterTextChanged(const QString &newText); /** Called when one of the actions (kill, renice etc) is clicked etc */ - void actionTriggered(QObject *object); + void actionTriggered(QAction *result); protected: /** Inherit QWidget::showEvent(QShowEvent *) to enable the timer, for updates, when visible */ diff --git a/processui/ksysguardprocesslist.cpp b/processui/ksysguardprocesslist.cpp --- a/processui/ksysguardprocesslist.cpp +++ b/processui/ksysguardprocesslist.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -369,17 +368,14 @@ 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 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(); @@ -620,12 +616,11 @@ d->mProcessContextMenu->popup(d->mUi->treeView->viewport()->mapToGlobal(point)); } -void KSysGuardProcessList::actionTriggered(QObject *object) { +void KSysGuardProcessList::actionTriggered(QAction *result) { if(!isVisible()) //Ignore triggered actions if we are not visible! return; //Reset the text back to normal d->selectParent->setText(i18n("Jump to Parent Process")); - QAction *result = qobject_cast(object); if(result == nullptr) { //Escape was pressed. Do nothing. } else if(result == d->renice) {