KDateTable

KDE 4.7 PyKDE API Reference

- KDE's Python API

# KDateTable Class Reference

`from PyKDE4.kdeui import *`

Inherits: QWidget → QObject

## Detailed Description

Date selection table. This is a support class for the KDatePicker class. It just draws the calendar table without titles, but could theoretically be used as a standalone.

When a date is selected by the user, it emits a signal: dateSelected(QDate)

"KDE Date Selection Table"

Internal:

Author:
  Tim Gilman, Mirko Boehm

## Enumerations
BackgroundMode | { NoBgMode, RectangleMode, CircleMode }
## Signals
| aboutToShowContextMenu (KMenu menu, QDate date)
| dateChanged (QDate date)
| dateChanged (QDate cur, QDate old)
| tableClicked ()
## Methods
| __init__ (self, QWidget parent=0)
| __init__ (self, QDate a0, QWidget parent=0)
| __init__ (self, KDateTable a0)
KCalendarSystem | calendar (self)
QDate | date (self)
QDate | dateFromPos (self, int pos)
bool | event (self, QEvent e)
| focusInEvent (self, QFocusEvent e)
| focusOutEvent (self, QFocusEvent e)
| keyPressEvent (self, QKeyEvent e)
| mousePressEvent (self, QMouseEvent e)
| paintEvent (self, QPaintEvent e)
bool | popupMenuEnabled (self)
int | posFromDate (self, QDate date)
bool | setCalendar (self, KCalendarSystem calendar=0)
bool | setCalendar (self, QString calendarType)
bool | setCalendarSystem (self, KLocale.CalendarSystem calendarSystem)
| setCustomDatePainting (self, QDate date, QColor fgColor, KDateTable.BackgroundMode bgMode=KDateTable.NoBgMode, QColor bgColor=QColor())
bool | setDate (self, QDate date)
| setFontSize (self, int size)
| setPopupMenuEnabled (self, bool enable)
QSize | sizeHint (self)
| unsetCustomDatePainting (self, QDate date)
| wheelEvent (self, QWheelEvent e)

## Signal Documentation

aboutToShowContextMenu | ( | KMenu | menu,
|  | QDate | date
| ) |  |  |

A popup menu for a given date is about to be shown (as when the user right clicks on that date and the popup menu is enabled). Connect the slot where you fill the menu to this signal.

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

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

This function behaves essentially like the one above. The selected date changed.

Parameters:

  | cur | The current date
  | old | The date before the date was changed

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

dateChanged | ( | QDate | cur,
|  | QDate | old
| ) |  |  |

This function behaves essentially like the one above. The selected date changed.

Parameters:

  | cur | The current date
  | old | The date before the date was changed

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

tableClicked | ( |  | ) |

A date has been selected by clicking on the table.

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

## Method Documentation

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

The constructor.

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

The constructor.

__init__ | ( | self, |
|  | KDateTable | a0
| ) |  |  |

KCalendarSystem calendar | ( |  | self ) |

Returns the currently selected calendar system.

Returns:
  a KCalendarSystem object

QDate date | ( |  | self ) |

Returns:
  the selected date.

QDate dateFromPos | ( | self, |
|  | int | pos
| ) |  |  |

calculate the date that is displayed at a given cell in the matrix. pos is the 0-based index in the matrix. Inverse function to posForDate().

bool event | ( | self, |
|  | QEvent | e
| ) |  |  |

Cell highlight on mouse hovering

focusInEvent | ( | self, |
|  | QFocusEvent | e
| ) |  |  |

focusOutEvent | ( | self, |
|  | QFocusEvent | e
| ) |  |  |

keyPressEvent | ( | self, |
|  | QKeyEvent | e
| ) |  |  |

mousePressEvent | ( | self, |
|  | QMouseEvent | e
| ) |  |  |

React on mouse clicks that select a date.

paintEvent | ( | self, |
|  | QPaintEvent | e
| ) |  |  |

bool popupMenuEnabled | ( |  | self ) |

Returns if the popup menu is enabled or not

int posFromDate | ( | self, |
|  | QDate | date
| ) |  |  |

calculate the position of the cell in the matrix for the given date. The result is the 0-based index.

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

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

Since:
  4.6

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

Parameters:

  | calendarSystem | the calendar system to use

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

setCustomDatePainting | ( | self, |
|  | QDate | date,
|  | QColor | fgColor,
|  | KDateTable.BackgroundMode | bgMode=KDateTable.NoBgMode,
|  | QColor | bgColor=QColor()
| ) |  |  |

Makes a given date be painted with a given foregroundColor, and background (a rectangle, or a circle/ellipse) in a given color.

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

Select and display this date.

setFontSize | ( | self, |
|  | int | size
| ) |  |  |

Set the font size of the date table.

setPopupMenuEnabled | ( | self, |
|  | bool | enable
| ) |  |  |

Enables a popup menu when right clicking on a date.

When it's enabled, this object emits a aboutToShowContextMenu signal where you can fill in the menu items.

QSize sizeHint | ( |  | self ) |

Returns a recommended size for the widget. To save some time, the size of the largest used cell content is calculated in each paintCell() call, since all calculations have to be done there anyway. The size is stored in maxCell. The sizeHint() simply returns a multiple of maxCell.

unsetCustomDatePainting | ( | self, |
|  | QDate | date
| ) |  |  |

Unsets the custom painting of a date so that the date is painted as usual.

wheelEvent | ( | self, |
|  | QWheelEvent | e
| ) |  |  |

## Enumeration Documentation

BackgroundMode

Enumerator:

  NoBgMode = 0 |
  RectangleMode |
  CircleMode |