Qt Reference Documentation

QML TimePickerDialog Element

Shows the time picker dialog. More...

Inherits CommonDialog

This element was introduced in Qt Quick Components 1.0.


Detailed Description

Showing a Time Picker Dialog

The code snippet below illustrates how to create a TimePickerDialog.

 TimePickerDialog {
     id: tDialog
     titleText: "Alarm Time"
     onAccepted: callbackFunction()

 function launchDialog() {

 function launchDialogToTime(hour, minute) {
     tDialog.hour = hour;
     tDialog.minute = minute;
     tDialog.fields = DateTime.Hours | DateTime.Minutes;

 function callbackFunction() {
     result.text = tDialog.hour + ":" + tDialog.minute + ":" + tDialog.second

See also Dialog.

Property Documentation

acceptButtonText : enum

The button text for the accept button. The value is optional.

fields : enum

Binary flag for setting the time picker to show hours, minutes, and/or seconds. The valid values are DateTime.Hours, DateTime.Minutes, DateTime.Seconds, and DateTime.All. You can combine the values with binary operator |, for example DateTime.Minutes | DateTime.Seconds.

The default value is DateTime.Hours | DateTime.Minutes.

hour : int

The displayed hour. The default value is 0.

hourMode : enum

Sets the TimePicker to show time in either 24-hour or 12-hour clock format. The valid values are DateTime.TwentyFourHours and DateTime.TwelveHours. The default value is the system time format.

minute : int

The displayed minute. The default value is 0.

rejectButtonText : string

The button text for the reject button. The value is optional.

second : int

The displayed second. The default value is 0.

titleText : string

The title text for the dialog if the value is not null. If further customization is needed, use the title property instead.