Qt Reference Documentation

QML TimePickerDialog Element

Shows the time picker dialog. More...

Inherits CommonDialog

  • List of all members, including inherited members
  • Properties

    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() {
         tDialog.open();
     }
    
     function launchDialogToTime(hour, minute) {
         tDialog.hour = hour;
         tDialog.minute = minute;
         tDialog.fields = DateTime.Hours | DateTime.Minutes;
         tDialog.open();
     }
    
     function callbackFunction() {
         result.text = tDialog.hour + ":" + tDialog.minute + ":" + tDialog.second
     }

    See also Dialog.

    Property Documentation

    read-onlyacceptButtonText : enum

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


    read-onlyfields : 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.


    read-onlytitleText : string

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