summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorRaquel Medina <raquel.medina@konsulko.com>2019-07-12 00:21:48 +0300
committerRaquel Medina <raquel.medina@konsulko.com>2019-07-12 02:22:10 +0300
commite34acd44166035729ea58ad04172778102ca165f (patch)
treeac9bc60c36f35a44374d9bf37286e951a2c6ca81 /app
parent0c66efbece15fcb37b1243f6291646bd6641dc30 (diff)
settings: datetime: qml: fix warning on model inithalibut_7.99.3halibut/7.99.37.99.3
- workaround invalid currentIndex - rework model initialization from array Bug-AGL: SPEC-2635 Signed-off-by: Raquel Medina <raquel.medina@konsulko.com> Change-Id: I7e218ee73aa40f9e85271d480c98a7eb45ac29b5
Diffstat (limited to 'app')
-rw-r--r--app/datetime/DateEdit.qml14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/datetime/DateEdit.qml b/app/datetime/DateEdit.qml
index f9f75fd..abfcfa9 100644
--- a/app/datetime/DateEdit.qml
+++ b/app/datetime/DateEdit.qml
@@ -65,7 +65,7 @@ GridLayout {
Component.onCompleted: regenerateModel()
function regenerateModel() {
var eom = 0
- var y = yearControl.model[yearControl.currentIndex]
+ var y = yearControl.currentIndex === -1 ? yearControl.model[0] : yearControl.model[yearControl.currentIndex]
var m = monthControl.currentIndex + 1
switch (m) {
case 2:
@@ -103,13 +103,13 @@ GridLayout {
Tumbler {
id: yearControl
- Component.onCompleted: {
- var arr = new Array
- for (var i = 2010; i < 2050; i++) {
+ readonly property var years: (function() {
+ var arr = []
+ for (var i = 2010; i < 2050; i++)
arr.push(i)
- }
- yearControl.model = arr
- }
+ return arr
+ })()
+ model: years
onCurrentIndexChanged: dayControl.regenerateModel()
EditSeparator { anchors.fill: parent }
}