Compare commits

..

2 Commits

Author SHA1 Message Date
1e3f7a988d Added a disabled color to month days which should not be visible in the
current calendar
2025-12-15 00:44:06 +02:00
76857eaeb8 Fixed a bug in which the text of the calendar did not appear 2025-11-16 17:58:53 +02:00
3 changed files with 56 additions and 34 deletions

View File

@@ -1,36 +1,43 @@
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Controls 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 { GridLayout {
columns: 2 columns: 1
DayOfWeekRow { DayOfWeekRow {
locale: grid.locale locale: grid.locale
Layout.column: 1
Layout.fillWidth: true Layout.fillWidth: true
} }
WeekNumberColumn { // WeekNumberColumn {
month: grid.month // month: grid.month
year: grid.year // year: grid.year
locale: grid.locale // locale: grid.locale
Layout.fillHeight: true // Layout.fillHeight: true
delegate: Text { // delegate: Text {
text: weekNumber // text: weekNumber
font: control.font // horizontalAlignment: Text.AlignHCenter
horizontalAlignment: Text.AlignHCenter // verticalAlignment: Text.AlignVCenter
verticalAlignment: Text.AlignVCenter // color: myPalette.text
color: myPalette.text // required property int weekNumber
required property int weekNumber // }
} // }
}
MonthGrid { MonthGrid {
id: grid id: grid
month: Calendar.November month: Calendar.November
year: 2025 year: currentDate.getFullYear()
locale: Qt.locale("en_US") locale: Qt.locale("en_US")
Layout.fillWidth: true Layout.fillWidth: true
@@ -38,11 +45,11 @@ GridLayout {
delegate: Text { delegate: Text {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
opacity: model.month === monthGrid.month ? 1 : 0 text: model.day
text: monthGrid.locale.toString(model.date, "d") color: model.month === currentDate.getMonth() ? myPalette.text : disabledPalette.text
font: monthGrid.font
required property var model 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
} }