Added a disabled color to month days which should not be visible in the

current calendar
This commit is contained in:
2025-12-15 00:44:06 +02:00
parent 76857eaeb8
commit 1e3f7a988d
3 changed files with 62 additions and 37 deletions

View File

@@ -1,45 +1,55 @@
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Controls import QtQuick.Controls
import QtQml
GridLayout { Flickable {
columns: 2 id: flickable
width: 200
height: 200
onDragStarted: console.info("Drag has started")
onDragEnded: console.info("Drag has ended")
DayOfWeekRow { GridLayout {
locale: grid.locale columns: 1
Layout.column: 1 DayOfWeekRow {
Layout.fillWidth: true locale: grid.locale
}
WeekNumberColumn {
month: grid.month Layout.fillWidth: true
year: grid.year }
locale: grid.locale
Layout.fillHeight: true // WeekNumberColumn {
delegate: Text { // month: grid.month
text: weekNumber // year: grid.year
horizontalAlignment: Text.AlignHCenter // locale: grid.locale
verticalAlignment: Text.AlignVCenter // Layout.fillHeight: true
color: myPalette.text // delegate: Text {
required property int weekNumber // text: weekNumber
} // horizontalAlignment: Text.AlignHCenter
} // verticalAlignment: Text.AlignVCenter
// color: myPalette.text
MonthGrid { // required property int weekNumber
id: grid // }
month: Calendar.November // }
year: 2025
locale: Qt.locale("en_US") MonthGrid {
id: grid
Layout.fillWidth: true month: Calendar.November
Layout.fillHeight: true year: currentDate.getFullYear()
delegate: Text { locale: Qt.locale("en_US")
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter Layout.fillWidth: true
text: model.day Layout.fillHeight: true
color: myPalette.text delegate: Text {
required property var model horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: model.day
color: model.month === currentDate.getMonth() ? myPalette.text : disabledPalette.text
required property var model
}
} }
} }
required property date currentDate
} }

View File

@@ -9,7 +9,18 @@ Window {
minimumWidth: 200 minimumWidth: 200
minimumHeight: 150 minimumHeight: 150
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active } SystemPalette
{
id: myPalette;
colorGroup: SystemPalette.Active
}
SystemPalette
{
id: disabledPalette;
colorGroup: SystemPalette.Disabled
}
color: myPalette.window color: myPalette.window
id: name id: name

View File

@@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Controls import QtQuick.Controls
Dialog { Dialog {
id: dialog id: userDialog
modal: true modal: true
title: "Configure a new user" title: "Configure a new user"
width: 600 width: 600
@@ -37,8 +37,12 @@ Dialog {
CalendarGrid { CalendarGrid {
id: dateOfBirthGrid id: dateOfBirthGrid
currentDate: dateOfBirth
} }
} }
property date dateOfBirth: new Date()
property date dateOfDeath: new Date()
standardButtons: Dialog.Ok | Dialog.Cancel standardButtons: Dialog.Ok | Dialog.Cancel
} }