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 @@ ...@@ -12,6 +12,7 @@
#include <QPainter> #include <QPainter>
#include <QPrintDialog> #include <QPrintDialog>
#include <QPrinter> #include <QPrinter>
#include <numeric>
#include <KLocalizedString> #include <KLocalizedString>
...@@ -279,10 +280,7 @@ void CrontabPrinter::drawTable(const QList<int> &columnWidths) ...@@ -279,10 +280,7 @@ void CrontabPrinter::drawTable(const QList<int> &columnWidths)
{ {
mPainter->translate(0, -mCurrentRowPosition + computeMargin()); mPainter->translate(0, -mCurrentRowPosition + computeMargin());
int columnWidthsTotal = 0; int columnWidthsTotal = std::accumulate(columnWidths.begin(), columnWidths.end(), 0);
for (int columnWidth : columnWidths) {
columnWidthsTotal += columnWidth;
}
const int margin = computeMargin(); const int margin = computeMargin();
int linePositionX = margin; int linePositionX = margin;
......
...@@ -14,10 +14,10 @@ CTSaveStatus::CTSaveStatus() ...@@ -14,10 +14,10 @@ CTSaveStatus::CTSaveStatus()
} }
CTSaveStatus::CTSaveStatus(const QString &errorMessage, const QString &detailErrorMessage) CTSaveStatus::CTSaveStatus(const QString &errorMessage, const QString &detailErrorMessage)
: mErrorStatus(true)
, mError(errorMessage)
, mDetailError(detailErrorMessage)
{ {
mErrorStatus = true;
mError = errorMessage;
mDetailError = detailErrorMessage;
} }
QString CTSaveStatus::errorMessage() const QString CTSaveStatus::errorMessage() const
......
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