Commit 30235d23 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

USe std::find_if here

parent cb26eff2
Pipeline #85955 passed with stage
in 10 minutes and 9 seconds
......@@ -96,11 +96,12 @@ QList<KToggleAction *> CustomToolsWidgetNg::actionList() const
void CustomToolsWidgetNg::setText(const QString &text)
{
if (isVisible()) {
for (PimCommon::CustomToolsViewInterface *interface : std::as_const(d->mListInterfaceView)) {
if (interface == d->mStackedWidget->currentWidget()) {
interface->setText(text);
break;
}
auto currentWidget = d->mStackedWidget->currentWidget();
auto it = std::find_if(d->mListInterfaceView.cbegin(), d->mListInterfaceView.cend(), [currentWidget](auto interface) {
return interface == currentWidget;
});
if (it != d->mListInterfaceView.cend()) {
(*it)->setText(text);
}
}
}
Supports Markdown
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