#include <kptdatetable.h>
Signals | |
void | dateChanged (QDate) |
void | tableClicked () |
void | weekdaySelected (int) |
void | weekSelected (int, int) |
void | selectionCleared () |
Public Member Functions | |
DateTable (QWidget *parent=0, QDate date=QDate::currentDate(), const char *name="DateTable", Qt::WFlags f=0) | |
virtual QSize | sizeHint () const |
void | setFontSize (int size) |
bool | setDate (const QDate &, bool repaint=true) |
const QDate & | getDate () const |
bool | selectDate (const QDate &date_) |
void | addMarkedDate (QDate date, int state) |
bool | dateMarked (QDate date) |
void | addMarkedWeekday (int day, int state) |
void | setMarkedWeekday (int day, int state) |
void | setMarkedWeekdays (const IntMap days) |
bool | weekdayMarked (int day) |
DateMap | selectedDates () const |
IntMap | selectedWeekdays () const |
DateMap | markedDates () const |
IntMap | markedWeekdays () const |
void | clear () |
void | clearSelection () |
void | setEnabled (bool yes) |
bool | isEnabled () const |
void | markSelected (int state) |
Protected Member Functions | |
virtual void | paintCell (QPainter *, int, int) |
virtual void | viewportResizeEvent (QResizeEvent *) |
virtual void | contentsMousePressEvent (QMouseEvent *) |
virtual void | wheelEvent (QWheelEvent *e) |
virtual void | keyPressEvent (QKeyEvent *e) |
virtual void | focusInEvent (QFocusEvent *e) |
virtual void | focusOutEvent (QFocusEvent *e) |
bool | contentsMousePressEvent_internal (QMouseEvent *) |
int | weekOfYear (QDate date) const |
void | setWeekNumbers (QDate) |
bool | weekSelected (int row) |
bool | weekSelected () |
bool | weekdaySelected () |
bool | isWeekdaySelected (int day) |
bool | dateSelected (QDate date) |
bool | dateSelected () |
void | updateSelectedCells () |
void | updateMarkedCells () |
void | updateCells () |
QDate | getDate (int pos) const |
int | position (int row, int col) |
int | weekday (int col) const |
int | column (int weekday) const |
void | paintWeekday (QPainter *painter, int col) |
void | paintWeekNumber (QPainter *painter, int row) |
void | paintDay (QPainter *painter, int row, int col) |
virtual void | virtual_hook (int id, void *data) |
Protected Attributes | |
int | fontsize |
QDate | date |
int | firstday |
int | numdays |
int | numDaysPrevMonth |
QRect | maxCell |
Private Attributes | |
Q3MemArray< QPair< int, int > > | m_weeks |
int | m_currentRow |
DateMap | m_selectedDates |
IntMap | m_selectedWeekdays |
DateMap | m_markedDates |
IntMap | m_markedWeekdays |
int | m_dateStartCol |
bool | m_enabled |
QColor | colorBackgroundHoliday |
QColor | colorBackgroundWorkday |
QColor | colorTextHoliday |
QColor | colorTextWorkday |
QColor | colorLine |
QColor | backgroundSelectColor |
QColor | penSelectColor |
DateTablePrivate * | d |
Definition at line 258 of file kptdatetable.h.
KPlato::DateTable::DateTable | ( | QWidget * | parent = 0 , |
|
QDate | date = QDate::currentDate() , |
|||
const char * | name = "DateTable" , |
|||
Qt::WFlags | f = 0 | |||
) |
The constructor.
Definition at line 83 of file kptdatetable.cc.
References backgroundSelectColor, colorBackgroundHoliday, colorBackgroundWorkday, colorLine, colorTextHoliday, colorTextWorkday, m_dateStartCol, m_selectedDates, m_selectedWeekdays, m_weeks, penSelectColor, setDate(), and setFontSize().
QSize KPlato::DateTable::sizeHint | ( | ) | const [virtual] |
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 587 of file kptdatetable.cc.
References maxCell.
Referenced by KPlato::CalendarPanel::sizeHint().
void KPlato::DateTable::setFontSize | ( | int | size | ) |
Set the font size of the date table.
Definition at line 342 of file kptdatetable.cc.
References fontsize, and maxCell.
Referenced by DateTable(), and KPlato::CalendarPanel::setFontSize().
bool KPlato::DateTable::setDate | ( | const QDate & | , | |
bool | repaint = true | |||
) |
Select and display this date.
Definition at line 532 of file kptdatetable.cc.
References column(), d, date, dateChanged(), firstday, m_enabled, numdays, numDaysPrevMonth, and setWeekNumbers().
Referenced by DateTable(), keyPressEvent(), KPlato::CalendarPanel::setDate(), and wheelEvent().
const QDate & KPlato::DateTable::getDate | ( | ) | const |
Definition at line 575 of file kptdatetable.cc.
References date.
Referenced by contentsMousePressEvent_internal(), KPlato::CalendarPanel::getDate(), KPlato::CalendarPanel::monthBackwardClicked(), KPlato::CalendarPanel::monthForwardClicked(), paintDay(), KPlato::CalendarPanel::selectMonthClicked(), KPlato::CalendarPanel::selectWeekClicked(), KPlato::CalendarPanel::selectYearClicked(), KPlato::CalendarPanel::tableClickedSlot(), KPlato::CalendarPanel::yearBackwardClicked(), and KPlato::CalendarPanel::yearForwardClicked().
bool KPlato::DateTable::selectDate | ( | const QDate & | date_ | ) |
Definition at line 498 of file kptdatetable.cc.
References column(), d, date, dateChanged(), firstday, m_enabled, numdays, numDaysPrevMonth, and setWeekNumbers().
Referenced by contentsMousePressEvent_internal().
void KPlato::DateTable::addMarkedDate | ( | QDate | date, | |
int | state | |||
) | [inline] |
Definition at line 287 of file kptdatetable.h.
References KPlato::DateMap::insert(), and m_markedDates.
Referenced by KPlato::CalendarPanel::setCalendar().
bool KPlato::DateTable::dateMarked | ( | QDate | date | ) |
void KPlato::DateTable::addMarkedWeekday | ( | int | day, | |
int | state | |||
) |
void KPlato::DateTable::setMarkedWeekday | ( | int | day, | |
int | state | |||
) | [inline] |
Definition at line 291 of file kptdatetable.h.
References KPlato::IntMap::insert(), and m_markedWeekdays.
void KPlato::DateTable::setMarkedWeekdays | ( | const IntMap | days | ) |
Definition at line 645 of file kptdatetable.cc.
References m_markedWeekdays, and updateMarkedCells().
Referenced by KPlato::CalendarPanel::setCalendar().
bool KPlato::DateTable::weekdayMarked | ( | int | day | ) |
DateMap KPlato::DateTable::selectedDates | ( | ) | const [inline] |
Definition at line 295 of file kptdatetable.h.
References m_selectedDates.
Referenced by KPlato::CalendarPanel::selectedDates().
IntMap KPlato::DateTable::selectedWeekdays | ( | ) | const [inline] |
Definition at line 296 of file kptdatetable.h.
References m_selectedWeekdays.
Referenced by KPlato::CalendarPanel::selectedWeekdays().
DateMap KPlato::DateTable::markedDates | ( | ) | const [inline] |
Definition at line 298 of file kptdatetable.h.
References m_markedDates.
Referenced by KPlato::CalendarPanel::markedDates().
IntMap KPlato::DateTable::markedWeekdays | ( | ) | const [inline] |
Definition at line 299 of file kptdatetable.h.
References m_markedWeekdays.
Referenced by KPlato::CalendarPanel::markedWeekdays().
void KPlato::DateTable::clear | ( | ) |
Definition at line 679 of file kptdatetable.cc.
References clearSelection(), m_markedDates, and m_markedWeekdays.
Referenced by KPlato::CalendarPanel::clear(), and KPlato::CalendarPanel::setCalendar().
void KPlato::DateTable::clearSelection | ( | ) |
Definition at line 686 of file kptdatetable.cc.
References m_selectedDates, and m_selectedWeekdays.
Referenced by clear().
void KPlato::DateTable::setEnabled | ( | bool | yes | ) |
Definition at line 692 of file kptdatetable.cc.
References m_enabled, and updateCells().
Referenced by KPlato::CalendarPanel::setEnabled().
bool KPlato::DateTable::isEnabled | ( | ) | const [inline] |
void KPlato::DateTable::markSelected | ( | int | state | ) |
Definition at line 699 of file kptdatetable.cc.
References KPlato::IntMap::insert(), KPlato::DateMap::insert(), m_markedDates, m_markedWeekdays, m_selectedDates, m_selectedWeekdays, and updateSelectedCells().
Referenced by KPlato::CalendarPanel::markSelected().
void KPlato::DateTable::paintCell | ( | QPainter * | , | |
int | , | |||
int | ||||
) | [protected, virtual] |
Paint a cell.
Definition at line 251 of file kptdatetable.cc.
References colorLine, paintDay(), paintWeekday(), and paintWeekNumber().
void KPlato::DateTable::viewportResizeEvent | ( | QResizeEvent * | ) | [protected, virtual] |
Handle the resize events.
Definition at line 335 of file kptdatetable.cc.
void KPlato::DateTable::contentsMousePressEvent | ( | QMouseEvent * | ) | [protected, virtual] |
React on mouse clicks that select a date.
Definition at line 370 of file kptdatetable.cc.
References contentsMousePressEvent_internal(), d, date, m_dateStartCol, m_enabled, m_selectedDates, m_selectedWeekdays, selectionCleared(), KPlato::DateMap::toggle(), KPlato::IntMap::toggle(), KPlato::DateMap::toggleClear(), KPlato::IntMap::toggleClear(), updateSelectedCells(), weekday(), and weekdaySelected().
void KPlato::DateTable::wheelEvent | ( | QWheelEvent * | e | ) | [protected, virtual] |
void KPlato::DateTable::keyPressEvent | ( | QKeyEvent * | e | ) | [protected, virtual] |
void KPlato::DateTable::focusInEvent | ( | QFocusEvent * | e | ) | [protected, virtual] |
Definition at line 579 of file kptdatetable.cc.
void KPlato::DateTable::focusOutEvent | ( | QFocusEvent * | e | ) | [protected, virtual] |
Definition at line 583 of file kptdatetable.cc.
bool KPlato::DateTable::contentsMousePressEvent_internal | ( | QMouseEvent * | ) | [protected] |
Definition at line 486 of file kptdatetable.cc.
References getDate(), position(), and selectDate().
Referenced by contentsMousePressEvent().
int KPlato::DateTable::weekOfYear | ( | QDate | date | ) | const [protected] |
void KPlato::DateTable::setWeekNumbers | ( | QDate | ) | [protected] |
bool KPlato::DateTable::weekSelected | ( | int | row | ) | [protected] |
bool KPlato::DateTable::weekSelected | ( | ) | [protected] |
bool KPlato::DateTable::weekdaySelected | ( | ) | [protected] |
Referenced by contentsMousePressEvent().
bool KPlato::DateTable::isWeekdaySelected | ( | int | day | ) | [protected] |
bool KPlato::DateTable::dateSelected | ( | QDate | date | ) | [protected] |
bool KPlato::DateTable::dateSelected | ( | ) | [protected] |
void KPlato::DateTable::updateSelectedCells | ( | ) | [protected] |
Definition at line 618 of file kptdatetable.cc.
References KPlato::DateMap::contains(), date, firstday, m_selectedDates, and m_selectedWeekdays.
Referenced by contentsMousePressEvent(), and markSelected().
void KPlato::DateTable::updateMarkedCells | ( | ) | [protected] |
Definition at line 632 of file kptdatetable.cc.
References KPlato::DateMap::contains(), date, firstday, m_markedDates, and m_markedWeekdays.
Referenced by setMarkedWeekdays().
void KPlato::DateTable::updateCells | ( | ) | [protected] |
QDate KPlato::DateTable::getDate | ( | int | pos | ) | const [protected] |
int KPlato::DateTable::position | ( | int | row, | |
int | col | |||
) | [inline, protected] |
pos can be 1..42 row starts at 1, col depends on wether weeks are presented (in col 0)
Definition at line 348 of file kptdatetable.h.
References m_dateStartCol.
Referenced by contentsMousePressEvent_internal(), and paintDay().
int KPlato::DateTable::weekday | ( | int | col | ) | const [protected] |
Definition at line 665 of file kptdatetable.cc.
References m_dateStartCol.
Referenced by contentsMousePressEvent(), paintDay(), and paintWeekday().
int KPlato::DateTable::column | ( | int | weekday | ) | const [protected] |
Definition at line 672 of file kptdatetable.cc.
References m_dateStartCol.
Referenced by selectDate(), and setDate().
void KPlato::DateTable::paintWeekday | ( | QPainter * | painter, | |
int | col | |||
) | [protected] |
Definition at line 121 of file kptdatetable.cc.
References backgroundSelectColor, colorBackgroundHoliday, colorBackgroundWorkday, colorLine, colorTextHoliday, colorTextWorkday, m_enabled, m_markedWeekdays, m_selectedWeekdays, maxCell, KPlato::Map::NonWorking, penSelectColor, KPlato::IntMap::state(), weekday(), and KPlato::Map::Working.
Referenced by paintCell().
void KPlato::DateTable::paintWeekNumber | ( | QPainter * | painter, | |
int | row | |||
) | [protected] |
Definition at line 168 of file kptdatetable.cc.
References colorLine, m_enabled, m_weeks, and maxCell.
Referenced by paintCell().
void KPlato::DateTable::paintDay | ( | QPainter * | painter, | |
int | row, | |||
int | col | |||
) | [protected] |
Definition at line 192 of file kptdatetable.cc.
References backgroundSelectColor, colorBackgroundHoliday, colorBackgroundWorkday, colorLine, KPlato::DateMap::contains(), d, date, fontsize, getDate(), m_enabled, m_markedDates, m_markedWeekdays, m_selectedDates, maxCell, KPlato::Map::NonWorking, position(), KPlato::IntMap::state(), KPlato::DateMap::state(), weekday(), and KPlato::Map::Working.
Referenced by paintCell().
void KPlato::DateTable::dateChanged | ( | QDate | ) | [signal] |
The selected date changed.
Referenced by selectDate(), and setDate().
void KPlato::DateTable::tableClicked | ( | ) | [signal] |
A date has been selected by clicking on the table.
void KPlato::DateTable::weekdaySelected | ( | int | ) | [signal] |
void KPlato::DateTable::weekSelected | ( | int | , | |
int | ||||
) | [signal] |
void KPlato::DateTable::selectionCleared | ( | ) | [signal] |
All selections have been cleared
Referenced by contentsMousePressEvent().
void KPlato::DateTable::virtual_hook | ( | int | id, | |
void * | data | |||
) | [protected, virtual] |
Definition at line 1073 of file kptdatetable.cc.
int KPlato::DateTable::fontsize [protected] |
The font size of the displayed text.
Definition at line 360 of file kptdatetable.h.
Referenced by paintDay(), and setFontSize().
QDate KPlato::DateTable::date [protected] |
The currently selected date.
Definition at line 364 of file kptdatetable.h.
Referenced by contentsMousePressEvent(), getDate(), keyPressEvent(), paintDay(), selectDate(), setDate(), updateMarkedCells(), updateSelectedCells(), and wheelEvent().
int KPlato::DateTable::firstday [protected] |
The day of the first day in the month [1..7].
Definition at line 368 of file kptdatetable.h.
Referenced by getDate(), selectDate(), setDate(), updateMarkedCells(), and updateSelectedCells().
int KPlato::DateTable::numdays [protected] |
The number of days in the current month.
Definition at line 372 of file kptdatetable.h.
Referenced by selectDate(), and setDate().
int KPlato::DateTable::numDaysPrevMonth [protected] |
The number of days in the previous month.
Definition at line 376 of file kptdatetable.h.
Referenced by selectDate(), and setDate().
QRect KPlato::DateTable::maxCell [protected] |
Save the size of the largest used cell content.
Definition at line 380 of file kptdatetable.h.
Referenced by paintDay(), paintWeekday(), paintWeekNumber(), setFontSize(), and sizeHint().
Q3MemArray< QPair<int, int> > KPlato::DateTable::m_weeks [private] |
Definition at line 401 of file kptdatetable.h.
Referenced by DateTable(), paintWeekNumber(), and setWeekNumbers().
int KPlato::DateTable::m_currentRow [private] |
Definition at line 403 of file kptdatetable.h.
DateMap KPlato::DateTable::m_selectedDates [private] |
Definition at line 407 of file kptdatetable.h.
Referenced by clearSelection(), contentsMousePressEvent(), DateTable(), markSelected(), paintDay(), selectedDates(), and updateSelectedCells().
IntMap KPlato::DateTable::m_selectedWeekdays [private] |
Definition at line 408 of file kptdatetable.h.
Referenced by clearSelection(), contentsMousePressEvent(), DateTable(), markSelected(), paintWeekday(), selectedWeekdays(), and updateSelectedCells().
DateMap KPlato::DateTable::m_markedDates [private] |
Definition at line 411 of file kptdatetable.h.
Referenced by addMarkedDate(), clear(), dateMarked(), markedDates(), markSelected(), paintDay(), and updateMarkedCells().
IntMap KPlato::DateTable::m_markedWeekdays [private] |
Definition at line 412 of file kptdatetable.h.
Referenced by clear(), markedWeekdays(), markSelected(), paintDay(), paintWeekday(), setMarkedWeekday(), setMarkedWeekdays(), updateMarkedCells(), and weekdayMarked().
int KPlato::DateTable::m_dateStartCol [private] |
Definition at line 414 of file kptdatetable.h.
Referenced by column(), contentsMousePressEvent(), DateTable(), position(), and weekday().
bool KPlato::DateTable::m_enabled [private] |
Definition at line 415 of file kptdatetable.h.
Referenced by contentsMousePressEvent(), isEnabled(), keyPressEvent(), paintDay(), paintWeekday(), paintWeekNumber(), selectDate(), setDate(), and setEnabled().
QColor KPlato::DateTable::colorBackgroundHoliday [private] |
Definition at line 417 of file kptdatetable.h.
Referenced by DateTable(), paintDay(), and paintWeekday().
QColor KPlato::DateTable::colorBackgroundWorkday [private] |
Definition at line 418 of file kptdatetable.h.
Referenced by DateTable(), paintDay(), and paintWeekday().
QColor KPlato::DateTable::colorTextHoliday [private] |
QColor KPlato::DateTable::colorTextWorkday [private] |
QColor KPlato::DateTable::colorLine [private] |
Definition at line 421 of file kptdatetable.h.
Referenced by DateTable(), paintCell(), paintDay(), paintWeekday(), and paintWeekNumber().
QColor KPlato::DateTable::backgroundSelectColor [private] |
Definition at line 422 of file kptdatetable.h.
Referenced by DateTable(), paintDay(), and paintWeekday().
QColor KPlato::DateTable::penSelectColor [private] |
DateTablePrivate* KPlato::DateTable::d [private] |
Definition at line 428 of file kptdatetable.h.
Referenced by contentsMousePressEvent(), paintDay(), selectDate(), setDate(), and setWeekNumbers().