Ubuntu.Components.PickerPanel

Provides a panel for opening a DatePicker in place of the input panel or as Popover, depending on the form factor. More...

Import Statement: import Ubuntu.Components 1.3

Methods

Detailed Description

PickerPanel is a singleton component designed to open a DatePicker in the input panel area or in a Popover, depending on the form factor, following the design guides on date pickers.

import QtQuick 2.4
import Ubuntu.Components 1.3
MainWindow {
width: units.gu(40)
height: units.gu(71)
Page {
title: "PickerPanel"
Button {
id: dateButton
property http://doc.qt.io/qt-5/qml-date.html">date date: new Date()
text: Qt.formatDateTime(date, "yyyy/MMMM")
onClicked: PickerPanel.openDatePicker(dateButton, "date", "Years|Months")
}
}
}

The opened panel is closed automatically when the user taps/presses outside of the panel or Popover area.

Method Documentation

openDatePicker( caller, property, mode)

The function opens a DatePicker component in the input method area or in a popover, depending on the availability of an input method provider in the system and whether the size of the main screen width/height defines a phone form factor. The picked date will be read from and reported to the property of the caller as date type. This implies that the caller must have defined the given property of type date.

On failure, the function returns null. On success, the returned object has the following properties:

Object {
property DatePicker picker
property string pickerMode
property date date
property Item caller
property string callerProperty
signal closed()
}
PropertyDescription
pickerinstance of the DatePicker component shown in the panel/popup
pickerModerepresents the DatePicker::mode to be used. This is an optional parameter and if not defined, the default mode will be used.
daterepresents the date selected
callerthe instance of the component opening the panel
callerPropertythe property of the caller holding the date value which will be updated by the picker.
SignalDescription
closed()the signal is emitted when the panel or popover gets closed. The signal is handy when actions are performed upon panel close.