[Calendar] Wrap day name index around

Otherwise when the week starts on a day other than Sunday or Monday we access invalid day names.

CHANGELOG: Fixed week names not showing properly in calendar when week starts with a day other than Monday or Sunday

BUG: 390330

Differential Revision: https://phabricator.kde.org/D15309
This commit is contained in:
Kai Uwe Broulik 2018-09-06 12:41:16 +02:00
parent 38431eebfa
commit 020d3e3ebe

View File

@ -312,7 +312,7 @@ Item {
Components.Label {
width: daysCalendar.cellWidth
height: daysCalendar.cellHeight
text: Qt.locale(Qt.locale().uiLanguages[0]).dayName(calendarBackend.firstDayOfWeek + index, Locale.ShortFormat)
text: Qt.locale(Qt.locale().uiLanguages[0]).dayName(((calendarBackend.firstDayOfWeek + index) % days.count), Locale.ShortFormat)
font.pixelSize: Math.max(theme.smallestFont.pixelSize, daysCalendar.cellHeight / 3)
opacity: 0.4
horizontalAlignment: Text.AlignHCenter