Meego Wiki
Views

DatePicker API Snapshot

From MeeGo wiki
(Difference between revisions)
Jump to: navigation, search
(removed docu of functions which are private)
(removed docu of functions which were meant for internal use only)
 
Line 41: Line 41:
;hide  
;hide  
:Fades the picker out, inherited from ModalFog.
:Fades the picker out, inherited from ModalFog.
-
;today
 
-
:Returns the current date, internal use only.
 
-
:Return value:
 
-
:*''variant'' date, the current date
 
-
;isCurrentDate
 
-
:Returns true if parameter date matches the current date, internal use only.
 
-
:Parameters:
 
-
:*''Date'' date, a java date object.
 
-
:Return value:
 
-
:*''bool'', true if the parameter date matches the current date
 
-
;daysInMonth
 
-
:Returns the number of days of month mm in year yyyy, internal use only.
 
-
:Parameter:
 
-
:*''int'' mm, the month
 
-
:*''int'' yyyy, the month
 
-
:Return value:
 
-
:*''int'', the number of days in the given month and year
 
-
;isSelectedDate
 
-
:Returns true if the currently selected date is dd-mm-yyyy, internal use only.
 
-
:Parameters:
 
-
:*''int'' dd, the day
 
-
:*''int'' mm, the month
 
-
:*''int'' yyyy, the year
 
-
:Return value:
 
-
:*''bool'', true if the currently selected date matches the given date
 
-
;nexthMonth
 
-
:Returns the index of the following month, internal use only.
 
-
:Parameters:
 
-
:*''Date'' refDate, java Date object
 
-
:Return value:
 
-
:*''int'' the index of the following month
 
-
;prevMonth
 
-
:Returns the index of the former month, internal use only.
 
-
:Parameters:
 
-
:*''Date'' refDate, a java Date
 
-
:Return value:
 
-
:*''int'', the index of the former month
 
-
;setFuturePast
 
-
:Checks if the currently selected date is in the future or the past and sets the properties isFuture and isPast accordingly.
 
-
;updateSelectedDate
 
-
:Updates the day model if necessary, updates the spinners and sets the selected date.
 
-
:Parameter:
 
-
:*''int'' d, the new day
 
-
:*''int'' m, the new month
 
-
:*''int'' y, the new year
 
-
;setDays
 
-
:Updates the selected day.
 
-
:Parameters:
 
-
:*''int'' d, the new day
 
-
:*''int'' m, the new month
 
-
:*''int'' y, the new year
 
-
;changeDayModel
 
-
:Updates the day model if necessary.
 
-
:Parameters:
 
-
:*''int'' d, the new day
 
-
:*''int'' m, the new month
 
-
:*''int'' y, the new year
 
-
;checkSelectedDate
 
-
:Checks if the given date is in the range given by the properties minYear, minMonth, minDay, maxYear, maxMonth and maxDay
 
-
:Parameters:
 
-
:*''int'' d, the given day
 
-
:*''int'' m, the given month
 
-
:*''int'' y, the given year
 
   
   
=Example=
=Example=

Latest revision as of 09:37, 4 May 2011

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