Commit 1227f072 authored by Martin Straka's avatar Martin Straka

Fixed QML calendar layout

parent 848ca0a8
......@@ -21,7 +21,9 @@
* the two.
*/
import QtQuick 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
/*
* Provides a calendar interface.
......@@ -30,4 +32,24 @@ import QtQuick.Controls 1.4
*/
Calendar {
id: root
anchors.centerIn: parent
focus: true
style: CalendarStyle {
gridVisible: true
dayDelegate: Rectangle {
Rectangle {
anchors.fill: parent
border.color: "transparent"
color: styleData.date !== undefined && styleData.selected ? datovkaPalette.highlight : "transparent"
anchors.margins: styleData.selected ? -1 : 0
}
Label {
text: styleData.date.getDate()
anchors.centerIn: parent
font.bold: styleData.selected
color: styleData.valid ? datovkaPalette.text : datovkaPalette.mid
}
}
}
}
......@@ -22,7 +22,6 @@
*/
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.1
import cz.nic.mobileDatovka 1.0
......@@ -36,15 +35,12 @@ Dialog {
signal finished(int index, date selectedDate)
property int minimumInputSize: parent.width / 2
function isValidDate(d) {
return d instanceof Date && !isNaN(d);
}
function openCalendarDialogue(index, selDate, maxDate, title, text) {
root.title = title
rootText.text = text
function openCalendarDialogue(index, selDate, maxDate, title, dateDescr) {
root.title = title + " " + dateDescr
root.open()
root.fieldIndex = index
......@@ -58,31 +54,18 @@ Dialog {
// center dialogue
x: parent.width / 2 - width / 2
y: parent.height / 2 - height / 1.2
y: parent.height / 2 - height / 2
width: parent.width - 4*defaultMargin
focus: true
modal: true
title: qsTr("QML input dialog")
title: qsTr("Calendar dialog")
standardButtons: Dialog.Ok | Dialog.Cancel
contentItem: ColumnLayout {
width: parent.width - 4*defaultMargin
AccessibleText {
id: rootText
Layout.fillWidth: true
Layout.minimumWidth: minimumInputSize
Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline
wrapMode: Text.WordWrap
}
Calendar {
id: calendar
width: parent.width
}
} // ColumnLayout
contentItem: Calendar {
id: calendar
}
onAccepted: finished(fieldIndex, calendar.selectedDate)
// onRejected:
}
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