Possible calendar locale fix

This commit is contained in:
Ly-sec 2025-08-11 13:58:52 +02:00
parent c8aec206f2
commit ccd5fbba3a

View file

@ -21,7 +21,7 @@ NLoader {
border.color: Colors.backgroundTertiary border.color: Colors.backgroundTertiary
border.width: Math.max(1, Style.borderMedium * scaling) border.width: Math.max(1, Style.borderMedium * scaling)
width: 340 * scaling width: 340 * scaling
height: 320 // TBC height: 380 * scaling // Scale the height and make it larger
anchors.top: parent.top anchors.top: parent.top
anchors.right: parent.right anchors.right: parent.right
anchors.topMargin: Style.marginTiny * scaling anchors.topMargin: Style.marginTiny * scaling
@ -75,7 +75,7 @@ NLoader {
Layout.fillWidth: true Layout.fillWidth: true
} }
// Columns label (Monday to Sunday) // Columns label (respects locale's first day of week)
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: Style.marginSmall * scaling // Align with grid Layout.leftMargin: Style.marginSmall * scaling // Align with grid
@ -87,8 +87,9 @@ NLoader {
NText { NText {
text: { text: {
// Start with Monday (1) instead of Sunday (0) // Use the locale's first day of week setting
let dayIndex = (index + 1) % 7 let firstDay = Qt.locale().firstDayOfWeek
let dayIndex = (firstDay + index) % 7
return Qt.locale().dayName(dayIndex, Locale.ShortFormat) return Qt.locale().dayName(dayIndex, Locale.ShortFormat)
} }
color: Colors.accentSecondary color: Colors.accentSecondary
@ -125,8 +126,8 @@ NLoader {
} }
delegate: Rectangle { delegate: Rectangle {
width: Style.baseWidgetSize * scaling width: (Style.baseWidgetSize * scaling)
height: Style.baseWidgetSize * scaling height: (Style.baseWidgetSize * scaling)
radius: Style.radiusSmall * scaling radius: Style.radiusSmall * scaling
color: model.today ? Colors.accentPrimary : "transparent" color: model.today ? Colors.accentPrimary : "transparent"
@ -135,7 +136,7 @@ NLoader {
text: model.day text: model.day
color: model.today ? Colors.onAccent : Colors.textPrimary color: model.today ? Colors.onAccent : Colors.textPrimary
opacity: model.month === grid.month ? Style.opacityHeavy : Style.opacityLight opacity: model.month === grid.month ? Style.opacityHeavy : Style.opacityLight
font.pointSize: Style.fontSizeMedium * scaling font.pointSize: (Style.fontSizeMedium * scaling)
font.weight: model.today ? Style.fontWeightBold : Style.fontWeightRegular font.weight: model.today ? Style.fontWeightBold : Style.fontWeightRegular
} }