Compare commits
2 Commits
37fc8aac58
...
858c72011a
| Author | SHA1 | Date | |
|---|---|---|---|
| 858c72011a | |||
| 65d7cf9d58 |
@@ -6,61 +6,90 @@ Dialog {
|
||||
width: 300
|
||||
height: 300
|
||||
|
||||
id: dateRangeRootDialog
|
||||
|
||||
required property date currentDate
|
||||
required property SystemPalette calendarActivePalette;
|
||||
required property color disabledTextColor;
|
||||
|
||||
GridLayout {
|
||||
columns: 1
|
||||
enum ViewMode
|
||||
{
|
||||
DAY = 0,
|
||||
MONTH = 1,
|
||||
YEAR = 2
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
font.pixelSize: 22
|
||||
text: getMyDate()
|
||||
}
|
||||
property int viewMode: Qt.enumStringToValue(DateRangeSelector.ViewMode, "DAY")
|
||||
property date beginDate;
|
||||
property date endDate;
|
||||
|
||||
DayOfWeekRow {
|
||||
locale: grid.locale
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Flickable
|
||||
{
|
||||
onMovementStarted: console.log("Flick started")
|
||||
onMovementEnded: console.log("Flick ended")
|
||||
anchors.fill: parent
|
||||
contentHeight: myGridLayout.height
|
||||
|
||||
MonthGrid
|
||||
{
|
||||
GridLayout {
|
||||
id: myGridLayout
|
||||
columns: 1
|
||||
|
||||
id: grid
|
||||
month: Calendar.January
|
||||
year: currentDate.getFullYear()
|
||||
locale: Qt.locale("en_US")
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
delegate: Rectangle {
|
||||
border.color: model.day === currentDate.getDay() ? "green": "transparent"
|
||||
border.width: 3
|
||||
width: 30
|
||||
height: 20
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (model.day === 11)
|
||||
console.log(model.day)
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: 12
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: model.day
|
||||
color: model.month === currentDate.getMonth() ? calendarActivePalette.text : disabledTextColor
|
||||
}
|
||||
|
||||
required property var model
|
||||
Label
|
||||
{
|
||||
font.pixelSize: 22
|
||||
text: getMyDate()
|
||||
}
|
||||
|
||||
property date currentlySelectedDate: currentDate;
|
||||
DayOfWeekRow {
|
||||
visible: dateRangeRootDialog.viewMode === Qt.enumStringToValue(DateRangeSelector.ViewMode, "DAY")
|
||||
locale: grid.locale
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
MonthGrid
|
||||
{
|
||||
|
||||
id: grid
|
||||
month: currentDate.getMonth()
|
||||
year: currentDate.getFullYear()
|
||||
locale: Qt.locale("en_US")
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
delegate: Rectangle {
|
||||
border.color: model.day === currentDate.getDay() ? "green": "transparent"
|
||||
border.width: 3
|
||||
width: 30
|
||||
height: 20
|
||||
color: calendarActivePalette.base
|
||||
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: 12
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: model.day
|
||||
color: model.month === currentDate.getMonth() ? calendarActivePalette.text : disabledTextColor
|
||||
}
|
||||
|
||||
required property var model
|
||||
}
|
||||
|
||||
property date currentlySelectedDate: currentDate;
|
||||
}
|
||||
Row
|
||||
{
|
||||
Button
|
||||
{
|
||||
text: "Months"
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
text: "Years"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,4 +97,6 @@ Dialog {
|
||||
{
|
||||
return Qt.formatDateTime(currentDate, "MMM yyyy");
|
||||
}
|
||||
|
||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user