Commit 209ac955 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some cppcheck warning

parent c588b5f6
Pipeline #83377 passed with stage
in 8 minutes and 2 seconds
......@@ -770,7 +770,6 @@ void CalPrintTimetable::drawTimeTable(QPainter &p,
curDate = curDate.addDays(1);
}
QFont oldFont(p.font());
p.setFont(QFont(QStringLiteral("sans-serif"), 11, QFont::Normal));
const int lineSpacing = p.fontMetrics().lineSpacing();
......@@ -787,7 +786,7 @@ void CalPrintTimetable::drawTimeTable(QPainter &p,
if (maxAllDayEvents > 0) {
// Draw the side bar for all-day events.
const auto alldayLabel = i18nc("label for timetable all-day boxes", "All day");
QFont oldFont(p.font());
const QFont oldFont(p.font());
p.setFont(QFont(QStringLiteral("sans-serif"), 9, QFont::Normal));
const auto labelHeight = p.fontMetrics().horizontalAdvance(alldayLabel) + 2*padding();
alldayHeight = std::max(maxAllDayEvents*lineSpacing + 2*padding(), labelHeight);
......
......@@ -1284,7 +1284,6 @@ void CalPrintPluginBase::drawMonth(QPainter &p,
maxdays = daysinmonth;
}
int d;
float dayheight = float(daysBox.height()) / float(maxdays);
QColor holidayColor(240, 240, 240);
......@@ -1309,7 +1308,7 @@ void CalPrintPluginBase::drawMonth(QPainter &p,
workDays = CalendarSupport::workDays(startDate, endDate);
}
for (d = 0; d < daysinmonth; ++d) {
for (int d = 0; d < daysinmonth; ++d) {
QDate day(dt.year(), dt.month(), d + 1);
QRect dayBox(daysBox.left() /*+rand()%50*/, daysBox.top() + qRound(dayheight * d), daysBox.width() /*-rand()%50*/, 0);
// FIXME: When using a border width of 0 for event boxes,
......
......@@ -716,7 +716,7 @@ QList<QDate> CalendarSupport::workDays(QDate startDate, QDate endDate)
for (const QString &regionStr : holidays) {
KHolidays::HolidayRegion region(regionStr);
if (region.isValid()) {
for (auto const h : region.holidays(startDate, endDate)) {
for (auto const &h : region.holidays(startDate, endDate)) {
if (h.dayType() == KHolidays::Holiday::NonWorkday) {
for (int i = 0; i < h.duration(); i++) {
result.removeOne(h.observedStartDate().addDays(i));
......
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