Commit cb8395d4 authored by Claudio Cambra's avatar Claudio Cambra
Browse files

Date picker improvements

parent 805afd9e
Pipeline #105031 passed with stage
in 6 minutes and 41 seconds
......@@ -21,6 +21,7 @@ QQC2.Popup {
property bool showDays: true
implicitWidth: Kirigami.Units.gridUnit * 20
padding: 0
contentItem: DatePicker {
id: datePicker
......
......@@ -44,10 +44,10 @@ QQC2.ComboBox {
height: Kirigami.Units.gridUnit * 18
y: parent.y + parent.height
z: 1000
padding: 0
DatePicker {
contentItem: DatePicker {
id: datePicker
anchors.fill: parent
clickedDate: root.dateTime
selectedDate: root.dateTime
......
......@@ -7,7 +7,7 @@ import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami
import org.kde.kalendar 1.0 as Kalendar
Item {
QQC2.Control {
id: datepicker
signal datePicked(date pickedDate)
......@@ -19,6 +19,12 @@ Item {
property int month: selectedDate.getMonth()
property int day: selectedDate.getDate()
property bool showDays: true
property bool showControlHeader: true
topPadding: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
rightPadding: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
bottomPadding: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
leftPadding: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
onSelectedDateChanged: setToDate(selectedDate)
onShowDaysChanged: if (!showDays) pickerView.currentIndex = 1;
......@@ -118,15 +124,13 @@ Item {
selectedDate = new Date(selectedDate.getFullYear() + 10, selectedDate.getMonth(), selectedDate.getDate())
}
Layout.fillWidth: true
Layout.fillHeight: true
ColumnLayout {
anchors.fill: parent
contentItem: ColumnLayout {
id: pickerLayout
RowLayout {
id: headingRow
Layout.fillWidth: true
visible: datepicker.showControlHeader
Kirigami.Heading {
id: monthLabel
......@@ -190,6 +194,10 @@ Item {
onClicked: pickerView.currentIndex = 2
}
}
Kirigami.Separator {
Layout.topMargin: (-pickerLayout.spacing *2) - 1
Layout.fillWidth: true
}
QQC2.SwipeView {
id: pickerView
......@@ -476,8 +484,6 @@ Item {
datepicker.datePicked(date);
pickerView.currentIndex = 1;
}
}
}
}
......@@ -486,6 +492,3 @@ Item {
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment