Commit 50c23090 authored by Karel Slaný's avatar Karel Slaný Committed by Martin Straka

Trying to place the calendar dialogue.

parent 249eb59a
......@@ -118,7 +118,7 @@ ScrollableListView {
var today = new Date()
var tomorow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000)
var filledDate = Date.fromLocaleDateString(locale, textField.text, "yyyy-MM-dd")
calendarDialogue.openCalendarDialogue(filledDate, today, "Select date", gsDescr)
calendarDialogue.openCalendarDialogue(filledDate, today, "Select date", gsDescr, root.parent)
}
}
} // Row
......
......@@ -40,7 +40,12 @@ Dialog {
return d instanceof Date && !isNaN(d);
}
function openCalendarDialogue(selDate, maxDate, title, text) {
function openCalendarDialogue(selDate, maxDate, title, text, parentElement) {
// https://stackoverflow.com/questions/44128131/default-arguments-for-qml-function-gives-syntax-errors
if (parentElement === undefined) {
parentElement = null
}
root.title = title
rootText.text = text
root.open()
......@@ -51,11 +56,22 @@ Dialog {
if (isValidDate(selDate)) {
calendar.selectedDate = selDate
}
if (parentElement === null) {
// root.x = root.parent.width / 2 - width / 2
// root.y = root.parent.height / 2 - height / 1.2
// root.width = root.parent.width - 4*defaultMargin
} else {
root.parent = parentElement
// root.x = parentElement.width / 2 - width / 2
// root.y = parentElement.height / 2 - height / 1.2
// root.width = parentElement.width - 4*defaultMargin
}
}
// center dialogue
x: parent.width / 2 - width / 2
// y: parent.height / 2 - height / 1.2
y: parent.height / 2 - height / 1.2
width: parent.width - 4*defaultMargin
......
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