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

From Wiki
Jump to: navigation, search

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 Metadata
Tested with
SDK: Nokia Qt SDK 1.2
Devices(s): all devices based on Symbian Anna, Nokia Belle
Platform(s): Symbian Anna, Nokia Belle
Device(s): All
Dependencies: Symbian Qt Quick Components 1.1
Platform Security
Capabilities: None
Keywords: Qml, daytime, selector
Created: Den123 (15 Mar 2012)
Last edited: hamishwillee (02 May 2012)

QML Day of Week & Time Selector



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

Source code


import QtQuick 1.1
import 1.1
import 1.0 // contains this installed module
SelectionListItem {
id: root
property int curDay: Qt.Monday
property int curHour: 0
property int curMinute: 0
title: dlgSelectDayOfWeekAndTime.localizedDayNameByIdx( curDay )
subTitle: buildTimeString()
onClicked: {
dlgSelectDayOfWeekAndTime.curDay = root.curDay
dlgSelectDayOfWeekAndTime.curHour = root.curHour
dlgSelectDayOfWeekAndTime.curMinute = root.curMinute
DayOfWeekTimeDialog {
id: dlgSelectDayOfWeekAndTime
onAccepted: {
root.curDay = dlgSelectDayOfWeekAndTime.curDay
root.curHour = dlgSelectDayOfWeekAndTime.curHour
root.curMinute = dlgSelectDayOfWeekAndTime.curMinute
function buildTimeString()
var x = curHour < 10 ? "0" + curHour : curHour
x += ":"
x += curMinute < 10 ? "0" + curMinute : curMinute
return x

How to use

DayOfWeekTimeSelector {
curDay: Qt.Monday
curHour: 12
curMinute: 0


This page was last modified on 2 May 2012, at 05:31.
55 page views in the last 30 days.