Added Month and Year buttons
Rearranged the DateRangeSelector dialog layout to also include a "Month" and "Year" view buttons, to make selecting a range of dates easier
This commit is contained in:
@@ -6,11 +6,32 @@ Dialog {
|
||||
width: 300
|
||||
height: 300
|
||||
|
||||
id: dateRangeRootDialog
|
||||
|
||||
required property date currentDate
|
||||
required property SystemPalette calendarActivePalette;
|
||||
required property color disabledTextColor;
|
||||
|
||||
enum ViewMode
|
||||
{
|
||||
DAY = 0,
|
||||
MONTH = 1,
|
||||
YEAR = 2
|
||||
}
|
||||
|
||||
property int viewMode: Qt.enumStringToValue(DateRangeSelector.ViewMode, "DAY")
|
||||
property date beginDate;
|
||||
property date endDate;
|
||||
|
||||
Flickable
|
||||
{
|
||||
onMovementStarted: console.log("Flick started")
|
||||
onMovementEnded: console.log("Flick ended")
|
||||
anchors.fill: parent
|
||||
contentHeight: myGridLayout.height
|
||||
|
||||
GridLayout {
|
||||
id: myGridLayout
|
||||
columns: 1
|
||||
|
||||
Label
|
||||
@@ -20,6 +41,7 @@ Dialog {
|
||||
}
|
||||
|
||||
DayOfWeekRow {
|
||||
visible: dateRangeRootDialog.viewMode === Qt.enumStringToValue(DateRangeSelector.ViewMode, "DAY")
|
||||
locale: grid.locale
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
@@ -28,7 +50,7 @@ Dialog {
|
||||
{
|
||||
|
||||
id: grid
|
||||
month: Calendar.January
|
||||
month: currentDate.getMonth()
|
||||
year: currentDate.getFullYear()
|
||||
locale: Qt.locale("en_US")
|
||||
|
||||
@@ -39,14 +61,8 @@ Dialog {
|
||||
border.width: 3
|
||||
width: 30
|
||||
height: 20
|
||||
color: calendarActivePalette.base
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (model.day === 11)
|
||||
console.log(model.day)
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
@@ -62,10 +78,25 @@ Dialog {
|
||||
|
||||
property date currentlySelectedDate: currentDate;
|
||||
}
|
||||
Row
|
||||
{
|
||||
Button
|
||||
{
|
||||
text: "Month"
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
text: "Year"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getMyDate()
|
||||
{
|
||||
return Qt.formatDateTime(currentDate, "MMM yyyy");
|
||||
}
|
||||
|
||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user