Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.
QML Day of Week & Time Selector
This code snippet provides a Symbian-specific custom QML component DayOfWeekTimeSelector, suitable for showing day of week and time and for launching selector dialog.
Article QML Day of Week & Time Dialog describes how to build DayOfWeekTimeDialog. This dialog allows to select day of week and time. The best way to show selected day and time as well as to launch DayOfWeekTimeDialog is to build separate component selector.
The code snippet below shows the full QML-component that implements this functionality.
The component uses SelectionListItem as a base and offers following settings:
- curDay - day of the week: Qt.Monday, Qt.Tuesday, ... Qt.Sunday
- curHour - hours: 0 - 23
- curMinute - minutes: 0 - 59
import QtQuick 1.1
import com.nokia.symbian 1.1
import com.symbian.extras.community 1.0 // https://projects.developer.nokia.com/symcommunityqtquickextras contains this installed module
property int curDay: Qt.Monday
property int curHour: 0
property int curMinute: 0
title: dlgSelectDayOfWeekAndTime.localizedDayNameByIdx( curDay )
dlgSelectDayOfWeekAndTime.curDay = root.curDay
dlgSelectDayOfWeekAndTime.curHour = root.curHour
dlgSelectDayOfWeekAndTime.curMinute = root.curMinute
root.curDay = dlgSelectDayOfWeekAndTime.curDay
root.curHour = dlgSelectDayOfWeekAndTime.curHour
root.curMinute = dlgSelectDayOfWeekAndTime.curMinute
var x = curHour < 10 ? "0" + curHour : curHour
x += ":"
x += curMinute < 10 ? "0" + curMinute : curMinute
How to use