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,35 +1,43 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQml
Flickable {
id: flickable
width: 200
height: 200
onDragStarted: console.info("Drag has started")
onDragEnded: console.info("Drag has ended")
GridLayout {
columns: 2
columns: 1
DayOfWeekRow {
locale: grid.locale
Layout.column: 1
Layout.fillWidth: true
}
WeekNumberColumn {
month: grid.month
year: grid.year
locale: grid.locale
Layout.fillHeight: true
delegate: Text {
text: weekNumber
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: myPalette.text
required property int weekNumber
}
}
// WeekNumberColumn {
// month: grid.month
// year: grid.year
// locale: grid.locale
// Layout.fillHeight: true
// delegate: Text {
// text: weekNumber
// horizontalAlignment: Text.AlignHCenter
// verticalAlignment: Text.AlignVCenter
// color: myPalette.text
// required property int weekNumber
// }
// }
MonthGrid {
id: grid
month: Calendar.November
year: 2025
year: currentDate.getFullYear()
locale: Qt.locale("en_US")
Layout.fillWidth: true
@@ -38,8 +46,10 @@ GridLayout {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: model.day
color: myPalette.text
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
minimumHeight: 150
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
SystemPalette
{
id: myPalette;
colorGroup: SystemPalette.Active
}
SystemPalette
{
id: disabledPalette;
colorGroup: SystemPalette.Disabled
}
color: myPalette.window
id: name

View File

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