KDateComboBox

KDE 4.9 PyKDE API Reference

- KDE's Python API

# KDateComboBox Class Reference

`from PyKDE4.kdeui import *`

Inherits: KComboBox → QComboBox → QWidget → QObject

## Detailed Description

## Enumerations
Option | { EditDate, SelectDate, DatePicker, DateKeywords, WarnOnInvalid }
## Signals
| dateChanged (QDate date)
| dateEdited (QDate date)
| dateEntered (QDate date)
## Methods
| __init__ (self, QWidget parent=0)
| assignCalendarSystem (self, KLocale.CalendarSystem calendarSystem)
| assignDate (self, QDate date)
KCalendarSystem | calendar (self)
KLocale.CalendarSystem | calendarSystem (self)
QDate | date (self)
{QDate:QString} | dateMap (self)
KLocale.DateFormat | displayFormat (self)
bool | eventFilter (self, QObject object, QEvent event)
| focusInEvent (self, QFocusEvent event)
| focusOutEvent (self, QFocusEvent event)
| hidePopup (self)
bool | isNull (self)
bool | isValid (self)
| keyPressEvent (self, QKeyEvent event)
QDate | maximumDate (self)
QDate | minimumDate (self)
| mousePressEvent (self, QMouseEvent event)
KDateComboBox.Options | options (self)
| resetDateRange (self)
| resetMaximumDate (self)
| resetMinimumDate (self)
| resizeEvent (self, QResizeEvent event)
| setCalendar (self, KCalendarSystem calendar=0)
| setCalendarSystem (self, KLocale.CalendarSystem calendarSystem)
| setDate (self, QDate date)
| setDateMap (self, {QDate:QString} dateMap)
| setDateRange (self, QDate minDate, QDate maxDate, QString minWarnMsg=QString(), QString maxWarnMsg=QString())
| setDisplayFormat (self, KLocale.DateFormat format)
| setMaximumDate (self, QDate maxDate, QString maxWarnMsg=QString())
| setMinimumDate (self, QDate minTime, QString minWarnMsg=QString())
| setOptions (self, KDateComboBox.Options options)
| showPopup (self)
| wheelEvent (self, QWheelEvent event)

## Signal Documentation

dateChanged | ( | QDate | date
| ) |  |  |

Signal if the date has been changed either manually by the user or programatically.

The returned date may be invalid.

Parameters:

  | date | the new date

Signal syntax:
  `QObject.connect(source, SIGNAL("dateChanged(const QDate&)"), target_slot)`

dateEdited | ( | QDate | date
| ) |  |  |

Signal if the date is being manually edited by the user.

The returned date may be invalid.

Parameters:

  | date | the new date

Signal syntax:
  `QObject.connect(source, SIGNAL("dateEdited(const QDate&)"), target_slot)`

dateEntered | ( | QDate | date
| ) |  |  |

Signal if the date has been manually entered or selected by the user.

The returned date may be invalid.

Parameters:

  | date | the new date

Signal syntax:
  `QObject.connect(source, SIGNAL("dateEntered(const QDate&)"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | QWidget | parent=0
| ) |  |  |

Create a new KDateComboBox widget

By default the EditDate, SelectDate, DatePicker and DateKeywords options are enabled, the ShortDate format is used and the date is set to the current date.

assignCalendarSystem | ( | self, |
|  | KLocale.CalendarSystem | calendarSystem
| ) |  |  |

Assign the calendar system for the widget.

Virtual to allow sub-classes to apply extra validation rules.

Parameters:

  | time | the new time

assignDate | ( | self, |
|  | QDate | date
| ) |  |  |

Assign the date for the widget.

Virtual to allow sub-classes to apply extra validation rules.

Parameters:

  | date | the new date

KCalendarSystem calendar | ( |  | self ) |

Returns a pointer to the Calendar System object used by this widget

Usually this will be the Global Calendar System using the Global Locale, but this may have been changed to a custom Calendar System possibly using a custom Locale.

Normally you will not need to access this object.

See also:
  KCalendarSystem

See also:
  setCalendar

Returns:
  the current calendar system instance

KLocale.CalendarSystem calendarSystem | ( |  | self ) |

Returns the Calendar System type used by the widget

See also:
  KLocale.CalendarSystem

See also:
  setCalendarSystem()

Returns:
  the Calendar System currently used

QDate date | ( |  | self ) |

Return the currently selected date

Returns:
  the currently selected date

{QDate:QString} dateMap | ( |  | self ) |

Return the map of dates listed in the drop-down and their displayed string forms.

See also:
  setDateMap()

Returns:
  the select date map

KLocale.DateFormat displayFormat | ( |  | self ) |

Return the currently set date display format

By default this is the Short Date

Returns:
  the currently set date format

bool eventFilter | ( | self, |
|  | QObject | object,
|  | QEvent | event
| ) |  |  |

focusInEvent | ( | self, |
|  | QFocusEvent | event
| ) |  |  |

focusOutEvent | ( | self, |
|  | QFocusEvent | event
| ) |  |  |

hidePopup | ( |  | self ) |

bool isNull | ( |  | self ) |

Return if the current user input is null

See also:
  isValid()

Returns:
  if the current user input is null

bool isValid | ( |  | self ) |

Return if the current user input is valid

If the user input is null then it is not valid

See also:
  isNull()

Returns:
  if the current user input is valid

keyPressEvent | ( | self, |
|  | QKeyEvent | event
| ) |  |  |

QDate maximumDate | ( |  | self ) |

Return the current maximum date

Returns:
  the current maximum date

QDate minimumDate | ( |  | self ) |

Return the current minimum date

Returns:
  the current minimum date

mousePressEvent | ( | self, |
|  | QMouseEvent | event
| ) |  |  |

KDateComboBox.Options options | ( |  | self ) |

Return the currently set widget options

Returns:
  the currently set widget options

resetDateRange | ( |  | self ) |

Reset the minimum and maximum date to the default values.

See also:
  setDateRange()

resetMaximumDate | ( |  | self ) |

Reset the maximum date to the default

resetMinimumDate | ( |  | self ) |

Reset the minimum date to the default

resizeEvent | ( | self, |
|  | QResizeEvent | event
| ) |  |  |

setCalendar | ( | self, |
|  | KCalendarSystem | calendar=0
| ) |  |  |

Changes the calendar system to use. Can use its own local locale if set.

You retain ownership of the calendar object, it will not be destroyed with the widget.

Parameters:

  | calendar | the calendar system object to use, defaults to global

setCalendarSystem | ( | self, |
|  | KLocale.CalendarSystem | calendarSystem
| ) |  |  |

Set the Calendar System used for this widget. Uses the global locale.

See also:
  KLocale.CalendarSystem

See also:
  calendarSystem()

Parameters:

  | calendarSystem | the Calendar System to use

setDate | ( | self, |
|  | QDate | date
| ) |  |  |

Set the currently selected date

You can set an invalid date or a date outside the valid range, validity checking is only done via isValid().

Parameters:

  | date | the new date

setDateMap | ( | self, |
|  | {QDate:QString} | dateMap
| ) |  |  |

Set the list of dates able to be selected from the drop-down and the string form to display for those dates, e.g. "2010-01-01" and "Yesterday".

Any invalid or duplicate dates will be used, the list will NOT be sorted, and the minimum and maximum date will not be affected.

The dateMap is keyed by the date to be listed and the value is the string to be displayed. If you want the date to be displayed in the default date format then the string should be null. If you want a separator to be displayed then set the string to "seperator".

See also:
  dateMap()

Parameters:

  | dateMap | the map of dates able to be selected

setDateRange | ( | self, |
|  | QDate | minDate,
|  | QDate | maxDate,
|  | QString | minWarnMsg=QString(),
|  | QString | maxWarnMsg=QString()
| ) |  |  |

Set the valid date range to be applied by isValid().

Both dates must be valid and the minimum date must be less than or equal to the maximum date, otherwise the date range will not be set.

Parameters:

  | minDate | the minimum date
  | maxDate | the maximum date
  | minWarnMsg | the minimum warning message
  | maxWarnMsg | the maximum warning message

setDisplayFormat | ( | self, |
|  | KLocale.DateFormat | format
| ) |  |  |

Sets the date format to display.

By default is the Short Date format.

Parameters:

  | format | the date format to use

setMaximumDate | ( | self, |
|  | QDate | maxDate,
|  | QString | maxWarnMsg=QString()
| ) |  |  |

Set the maximum allowed date.

If the date is invalid, or less than current minimum, then the maximum will not be set.

See also:
  minimumDate()

See also:
  maximumDate()

See also:
  setMaximumDate()

See also:
  setDateRange()

Parameters:

  | maxDate | the maximum date
  | maxWarnMsg | the maximum warning message

setMinimumDate | ( | self, |
|  | QDate | minTime,
|  | QString | minWarnMsg=QString()
| ) |  |  |

Set the minimum allowed date.

If the date is invalid, or greater than current maximum, then the minimum will not be set.

See also:
  minimumDate()

See also:
  maximumDate()

See also:
  setMaximumDate()

See also:
  setDateRange()

Parameters:

  | minDate | the minimum date
  | minWarnMsg | the minimum warning message

setOptions | ( | self, |
|  | KDateComboBox.Options | options
| ) |  |  |

Set the new widget options

Parameters:

  | options | the new widget options

showPopup | ( |  | self ) |

wheelEvent | ( | self, |
|  | QWheelEvent | event
| ) |  |  |

## Enumeration Documentation

Option

Options provided by the widget

See also:
  options()

See also:
  setOptions()

Enumerator:

  EditTime = 0x0001 |
  SelectTime = 0x0002 |
  ForceTime = 0x0004 |
  WarnOnInvalid = 0x0008 |