Commit 2c702048 authored by Corbin Schwimmbeck's avatar Corbin Schwimmbeck
Browse files

Use a fancy stl function as recommended by cppcheck

It's just for fun, seemed like a neat trick the compiler recommended.
parent 68f21786
Pipeline #85885 passed with stage
in 36 seconds
......@@ -12,6 +12,7 @@
#include <QPainter>
#include <QPrintDialog>
#include <QPrinter>
#include <numeric>
#include <KLocalizedString>
......@@ -279,10 +280,7 @@ void CrontabPrinter::drawTable(const QList<int> &columnWidths)
{
mPainter->translate(0, -mCurrentRowPosition + computeMargin());
int columnWidthsTotal = 0;
for (int columnWidth : columnWidths) {
columnWidthsTotal += columnWidth;
}
int columnWidthsTotal = std::accumulate(columnWidths.begin(), columnWidths.end(), 0);
const int margin = computeMargin();
int linePositionX = margin;
......
......@@ -14,10 +14,10 @@ CTSaveStatus::CTSaveStatus()
}
CTSaveStatus::CTSaveStatus(const QString &errorMessage, const QString &detailErrorMessage)
: mErrorStatus(true)
, mError(errorMessage)
, mDetailError(detailErrorMessage)
{
mErrorStatus = true;
mError = errorMessage;
mDetailError = detailErrorMessage;
}
QString CTSaveStatus::errorMessage() const
......
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