27 property date time:
new Date()
42 property bool showHours:
true 52 property bool showMinutes:
true 62 property bool showSeconds:
false 78 property bool use24HourFormat: {
79 var fmStr =
Qt.locale().timeFormat(Locale.LongFormat);
81 [
"A",
"AP",
"a",
"ap"].forEach(
function(text){
82 if(fmStr.indexOf(text) !== -1)
98 readonly
property int hours: showHours ? (_hourTumbler.currentIndex + (!use24HourFormat && _amPmTumbler.currentIndex === 1 ? 12 : 0)) : 0
109 readonly property int minutes: showMinutes ? _minuteTumbler.currentIndex : 0
120 readonly property int seconds: showSeconds ? _secondsTumbler.currentIndex : 0
124 property date forceTime:
new Date()
125 property bool skipChange:
false 127 function recalcTime() {
128 if(_p.forceTime.getHours() !== hours ||
129 _p.forceTime.getMinutes() !== minutes ||
130 _p.forceTime.getSeconds() !== seconds) {
131 _p.skipChange =
true;
132 time =
new Date(0, 0, 0, hours, minutes, seconds);
133 _p.skipChange =
false;
140 Layout.fillHeight:
true 141 Layout.fillWidth:
true 142 Layout.preferredWidth: 0
149 var model =
new Array(use24HourFormat ? 24 : 12);
150 for(var i = 0; i < model.length; i++)
151 model[i] = i.toString();
156 currentIndex: use24HourFormat ? _p.forceTime.getHours() : (_p.forceTime.getHours() % 12)
157 onCurrentIndexChanged:
Qt.callLater(_p.recalcTime)
162 Layout.minimumWidth: implicitWidth
163 visible: showHours && showMinutes
170 var mod =
new Array(60)
171 for(var i = 0; i < mod.length; i++) {
172 var data = i.toString();
173 mod[i] = data.length < 2 ?
Qt.locale().zeroDigit + data : data;
177 currentIndex: _p.forceTime.getMinutes()
178 onCurrentIndexChanged:
Qt.callLater(_p.recalcTime)
183 Layout.minimumWidth: implicitWidth
184 visible: showSeconds && (showMinutes || showHours)
191 var mod =
new Array(60)
192 for(var i = 0; i < mod.length; i++) {
193 var data = i.toString();
194 mod[i] = data.length < 2 ?
Qt.locale().zeroDigit + data : data;
198 currentIndex: _p.forceTime.getSeconds()
199 onCurrentIndexChanged:
Qt.callLater(_p.recalcTime)
204 visible: !use24HourFormat && showHours
209 currentIndex: _p.forceTime.getHours() >= 12 ? 1 : 0
210 onCurrentIndexChanged:
Qt.callLater(_p.recalcTime)
215 Layout.fillHeight:
true 216 Layout.fillWidth:
true 217 Layout.preferredWidth: 0