KDateTable Class Reference
Date selection table. More...
#include <mkdatetbl.h>
Inheritance diagram for KDateTable:

Signals | |
void | dateChanged (QDate) |
The selected date changed. | |
void | tableClicked () |
A date has been selected by clicking on the table. | |
Public Member Functions | |
KDateTable (const QString &calType="gregorian", QWidget *parent=0, QDate date=QDate::currentDate(), const char *name=0, WFlags f=0) | |
The constructor. | |
virtual QSize | sizeHint () const |
Returns a recommended size for the widget. | |
void | setFontSize (int size) |
Set the font size of the date table. | |
bool | setDate (const QDate &) |
Select and display this date. | |
const QDate & | getDate () const |
Protected Member Functions | |
virtual void | paintCell (QPainter *, int, int) |
Paint a cell. | |
virtual void | viewportResizeEvent (QResizeEvent *) |
Handle the resize events. | |
virtual void | contentsMousePressEvent (QMouseEvent *) |
React on mouse clicks that select a date. | |
virtual void | keyPressEvent (QKeyEvent *e) |
virtual void | focusInEvent (QFocusEvent *e) |
virtual void | focusOutEvent (QFocusEvent *e) |
virtual void | virtual_hook (int id, void *data) |
Protected Attributes | |
int | fontsize |
The font size of the displayed text. | |
QDate | date |
The currently selected date. | |
int | firstday |
The day of the first day in the month [1..7]. | |
int | numdays |
The number of days in the current month. | |
int | numDaysPrevMonth |
The number of days in the previous month. | |
bool | unused_hasSelection |
unused | |
QRect | maxCell |
Save the size of the largest used cell content. |
Detailed Description
Date selection table.This is a support class for the KDatePicker class. It just draws the calender 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)
Definition at line 233 of file mkdatetbl.h.
Constructor & Destructor Documentation
|
The constructor.
Definition at line 90 of file mkdatetbl.cpp. References QDate::currentDate(), QDate::isValid(), setDate(), setFontSize(), QGridView::setNumCols(), and QGridView::setNumRows(). |
Member Function Documentation
|
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. Definition at line 449 of file mkdatetbl.cpp. References QRect::height(), maxCell, QGridView::numCols(), QGridView::numRows(), and QRect::width(). Referenced by KDatePicker::sizeHint(). |
|
Set the font size of the date table.
Definition at line 309 of file mkdatetbl.cpp. References QFontMetrics::boundingRect(), fontsize, QRect::height(), maxCell, QRect::setHeight(), QRect::setWidth(), KCalendarSystem::weekDayName(), and QRect::width(). Referenced by KDateTable(), and KDatePicker::setFontSize(). |
|
Select and display this date.
Definition at line 388 of file mkdatetbl.cpp. References date, dateChanged(), KCalendarSystem::dayOfTheWeek(), firstday, QDate::isValid(), KCalendarSystem::numberOfDaysInMonth(), KCalendarSystem::numberOfDaysPrevMonth(), numdays, and numDaysPrevMonth. Referenced by contentsMousePressEvent(), KDateTable(), and KDatePicker::setDate(). |
|
Paint a cell.
Reimplemented from QGridView. Definition at line 115 of file mkdatetbl.cpp. References QGridView::cellHeight(), QGridView::cellWidth(), date, KCalendarSystem::day(), QPainter::drawRect(), QPainter::drawText(), firstday, fontsize, QRect::height(), maxCell, numdays, numDaysPrevMonth, QPainter::pen(), QFont::setBold(), QPainter::setBrush(), QPainter::setFont(), QRect::setHeight(), QString::setNum(), QPainter::setPen(), QFont::setPointSize(), QRect::setWidth(), KCalendarSystem::weekDayName(), and QRect::width(). |
|
Handle the resize events.
Definition at line 300 of file mkdatetbl.cpp. References QGridView::setCellHeight(), and QGridView::setCellWidth(). |
|
React on mouse clicks that select a date.
Definition at line 333 of file mkdatetbl.cpp. References QDate::addDays(), QGridView::columnAt(), date, QDate::day(), KCalendarSystem::day(), firstday, QDate::month(), numdays, QMouseEvent::pos(), QGridView::rowAt(), setDate(), tableClicked(), QGridView::updateCell(), QPoint::x(), QPoint::y(), and QDate::year(). |
|
The selected date changed.
Referenced by setDate(). |
|
A date has been selected by clicking on the table.
Referenced by contentsMousePressEvent(). |
Member Data Documentation
|
The font size of the displayed text.
Definition at line 283 of file mkdatetbl.h. Referenced by paintCell(), and setFontSize(). |
|
The currently selected date.
Definition at line 287 of file mkdatetbl.h. Referenced by contentsMousePressEvent(), paintCell(), and setDate(). |
|
The day of the first day in the month [1..7].
Definition at line 291 of file mkdatetbl.h. Referenced by contentsMousePressEvent(), paintCell(), and setDate(). |
|
The number of days in the current month.
Definition at line 295 of file mkdatetbl.h. Referenced by contentsMousePressEvent(), paintCell(), and setDate(). |
|
The number of days in the previous month.
Definition at line 299 of file mkdatetbl.h. Referenced by paintCell(), and setDate(). |
|
unused
Definition at line 303 of file mkdatetbl.h. |
|
Save the size of the largest used cell content.
Definition at line 307 of file mkdatetbl.h. Referenced by paintCell(), setFontSize(), and sizeHint(). |
The documentation for this class was generated from the following files: