KDatePicker

KDE 4.5 PyKDE API Reference

- KDE's Python API

# KDatePicker Class Reference

`from PyKDE4.kdeui import *`

Inherits: QFrame → QWidget → QObject

## Detailed Description

A date selection widget.

Provides a widget for calendar date input.

Different from the previous versions, it now emits two types of signals, either dateSelected() or dateEntered() (see documentation for both signals).

A line edit has been added in the newer versions to allow the user to select a date directly by entering numbers like 19990101 or 990101.

"KDE Date Widget"

Author:
  Tim Gilman, Mirko Boehm

## Signals
| dateChanged (QDate date)
| dateEntered (QDate date)
| dateSelected (QDate date)
| tableClicked ()
## Methods
| __init__ (self, QWidget parent=0)
| __init__ (self, QDate dt, QWidget parent=0)
KCalendarSystem | calendar (self)
QDate | date (self)
| dateChangedSlot (self, QDate date)
KDateTable | dateTable (self)
bool | eventFilter (self, QObject o, QEvent e)
int | fontSize (self)
bool | hasCloseButton (self)
| lineEnterPressed (self)
| monthBackwardClicked (self)
| monthForwardClicked (self)
| resizeEvent (self, QResizeEvent a0)
| selectMonthClicked (self)
| selectYearClicked (self)
bool | setCalendar (self, KCalendarSystem calendar=0)
bool | setCalendar (self, QString calendarType)
| setCloseButton (self, bool enable)
bool | setDate (self, QDate date)
| setEnabled (self, bool enable)
| setFontSize (self, int a0)
QSize | sizeHint (self)
| tableClickedSlot (self)
| todayButtonClicked (self)
| uncheckYearSelector (self)
| weekSelected (self, int a0)
| yearBackwardClicked (self)
| yearForwardClicked (self)

## Signal Documentation

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

This signal is emitted each time the selected date is changed. Usually, this does not mean that the date has been entered, since the date also changes, for example, when another month is selected.

See also:
  dateSelected

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

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

This signal is emitted when enter is pressed and a VALID date has been entered before into the line edit. Connect to both dateEntered() and dateSelected() to receive all events where the user really enters a date.

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

dateSelected | ( | QDate | date
| ) |  |  |

This signal is emitted each time a day has been selected by clicking on the table (hitting a day in the current month). It has the same meaning as dateSelected() in older versions of KDatePicker.

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

tableClicked | ( |  | ) |

This signal is emitted when the day has been selected by clicking on it in the table.

Signal syntax:
  `QObject.connect(source, SIGNAL("tableClicked()"), target_slot)`

## Method Documentation

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

The constructor. The current date will be displayed initially.

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

The constructor. The given date will be displayed initially.

KCalendarSystem calendar | ( |  | self ) |

Returns the currently selected calendar system.

Returns:
  a KCalendarSystem object

QDate date | ( |  | self ) |

Returns:
  the selected date.

dateChangedSlot | ( | self, |
|  | QDate | date
| ) |  |  |

KDateTable dateTable | ( |  | self ) |

Returns:
  the KDateTable widget child of this KDatePicker widget.

bool eventFilter | ( | self, |
|  | QObject | o,
|  | QEvent | e
| ) |  |  |

int fontSize | ( |  | self ) |

Returns the font size of the widget elements.

bool hasCloseButton | ( |  | self ) |

Returns:
  true if a KDatePicker shows a close-button.

See also:
  setCloseButton

lineEnterPressed | ( |  | self ) |

monthBackwardClicked | ( |  | self ) |

monthForwardClicked | ( |  | self ) |

resizeEvent | ( | self, |
|  | QResizeEvent | a0
| ) |  |  |

selectMonthClicked | ( |  | self ) |

selectYearClicked | ( |  | self ) |

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

Changes the calendar system to use. Will always use global locale.

Parameters:

  | calendarType | the calendar system type to use

Returns:
  true if the calendar system was successfully set, false otherwise

bool setCalendar | ( | self, |
|  | QString | calendarType
| ) |  |  |

Changes the calendar system to use. Will always use global locale.

Parameters:

  | calendarType | the calendar system type to use

Returns:
  true if the calendar system was successfully set, false otherwise

setCloseButton | ( | self, |
|  | bool | enable
| ) |  |  |

By calling this method with enable = true, KDatePicker will show a little close-button in the upper button-row. Clicking the close-button will cause the KDatePicker's topLevelWidget()'s close() method being called. This is mostly useful for toplevel datepickers without a window manager decoration.

See also:
  hasCloseButton

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

Sets the date.

Returns:
  false and does not change anything if the date given is invalid.

setEnabled | ( | self, |
|  | bool | enable
| ) |  |  |

Enables or disables the widget.

setFontSize | ( | self, |
|  | int | a0
| ) |  |  |

Sets the font size of the widgets elements.

QSize sizeHint | ( |  | self ) |

The size hint for date pickers. The size hint recommends the minimum size of the widget so that all elements may be placed without clipping. This sometimes looks ugly, so when using the size hint, try adding 28 to each of the reported numbers of pixels.

tableClickedSlot | ( |  | self ) |

todayButtonClicked | ( |  | self ) |

uncheckYearSelector | ( |  | self ) |

weekSelected | ( | self, |
|  | int | a0
| ) |  |  |

yearBackwardClicked | ( |  | self ) |

yearForwardClicked | ( |  | self ) |