Meego Wiki
Views

DatePicker API Snapshot

From MeeGo wiki
Revision as of 09:37, 4 May 2011 by Pascaldietz (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Description

Displays control elements to choose a date by day, month and year. The values can either be chosen using the three PopupLists at the top or by the calender grid in the center. The min... and max... properties can be used to restrict the chosable date to a specific date. Selecting a date outside that range will disable the ok button. Make sure valid values for min and max are set, otherwise the DatePicker might not work as expected.

API properties

variant selectedDate
Contains the currently selected date.
int startYear
Sets the first year available in the year spinner, needs a positive value smaller or equal to endYear.
int endYear
Sets the last year available in the year spinner, needs a positive value bigger or equal to startYear.
int minYear
Sets the first selectable year, needs a positive value smaller or equal to maxYear.
int minMonth
Sets the first selectable month, needs a value from 1 to 12.
int minDay
Sets the first selectable day, needs a value from 1 to 31.
int maxYear
Sets the last selectable year, needs a positive value bigger or equal to minYear.
int maxMonth
Sets the last selectable month, needs a value from 1 to 12.
int maxDay
Sets the last selectable day, needs a value from 1 to 31.
bool isDateInRange
True if the selected date is in range of the min and max values.

Signals

dateSelected
Emitted when ok button is clicked, propagates the selected date.
Parameters:
  • variant date, a java Date object.

Functions

setSelectedDate
Sets the current date to the given values
Parameters:
  • int newDay, the new day to be set
  • int newMonth, the new month to be set
  • int newYear, the new year to be set
show
Fades the picker in, inherited from ModalFog.
hide
Fades the picker out, inherited from ModalFog.

Example

//a button labeled with the selected date
Button {
    id: dateButton

    DatePicker {
        id: datePicker

        onDateSelected: {
            dateButton.text = //TODO: where does Date come from?
        }
    }

    onClicked: {
        datePicker.show()
    }
}
Personal tools