5import org.mauikit.controls as Maui
6import org.mauikit.calendar as Kalendar
30 readonly property date startTime : new Date()
35 property int selectedMinute: selectedTime.getMinutes()
40 property int selectedHour: selectedTime.getHours()
45 property int timeZoneOffset : 0
50 property date selectedTime : startTime
55 property string format: control.selectedHour < 12 ? "AM
" : "PM
"
61 signal accepted(var time)
70 contentItem: RowLayout
82 checked: control.format === text
83 onTriggered: control.format = text
89 checked: control.format === text
91 onTriggered: control.format = text
95 Item {Layout.fillWidth: true}
102 control.updateSelectedTime(minutesTumbler.currentIndex, hoursTumbler.currentIndex, control.format)
103 control.accepted(control.selectedTime)
114 height: parent.height
115 anchors.horizontalCenter: parent.horizontalCenter
117 spacing: Maui.Style.space.medium
122 spacing: Maui.Style.space.medium
125 currentIndex: formatUTCHour(control.selectedHour)
131 checked : index === Tumbler.tumbler.currentIndex
132 text: formatText(Tumbler.tumbler.count, modelData)
133 opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2)
137 Tumbler.tumbler.currentIndex = modelData
138 control.updateSelectedTime(minutesTumbler.currentIndex, hoursTumbler.currentIndex)
141 background: Rectangle
144 color: checked ? Maui.Theme.highlightColor : hovered ? Maui.Theme.focusColor : "transparent"
145 radius: Maui.Style.radiusV
155 spacing: Maui.Style.space.medium
157 currentIndex: control.selectedMinute
162 checked : index === Tumbler.tumbler.currentIndex
163 text: formatText(Tumbler.tumbler.count, modelData)
164 opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2)
168 Tumbler.tumbler.currentIndex = modelData
169 control.updateSelectedTime(minutesTumbler.currentIndex, hoursTumbler.currentIndex)
172 background: Rectangle
175 color: checked ? Maui.Theme.highlightColor : hovered ? Maui.Theme.focusColor : "transparent"
176 radius: Maui.Style.radiusV
187 function formatUTCHour(hour : int) : int
202 function formatHourToUTC(hour : int, format : string) : int
228 function formatText(count : int, modelData : int) : string
230 var data = count === 12 ? modelData + 1 : modelData;
231 return data.toString().length < 2 ? "0
" + data : data;
240 function updateSelectedTime(minute, hour, format = control.format)
242 control.selectedMinute = minute
243 control.selectedHour = formatHourToUTC(hour, format)
245 var newdate = new Date()
247 newdate.setHours(control.selectedHour)
248 newdate.setMinutes(control.selectedMinute)
250 control.selectedTime = newdate
252 console.log("UPDATING TIMEW
", control.selectedTime.getHours(), control.selectedTime.getMinutes(), hour, minute, format, control.selectedTime.toLocaleTimeString())
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:35:11 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.