KPlato::CalendarPanel Class Reference

#include <kptcalendarpanel.h>

List of all members.

Signals

void dateChanged (QDate)
void dateSelected (QDate)
void dateEntered (QDate)
void tableClicked ()
void weekSelected (int week, int year)
void weekdaySelected (int day)
void selectionCleared ()

Public Member Functions

 CalendarPanel (QWidget *parent=0, QDate=QDate::currentDate(), const char *name=0, Qt::WFlags f=0)
 CalendarPanel (QWidget *parent, const char *name)
virtual ~CalendarPanel ()
QSize sizeHint () const
QSize minimumSizeHint () const
bool setDate (const QDate &)
const QDate & getDate () const
const QDate & date () const
void setEnabled (bool)
void setFontSize (int)
int fontSize () const
void setCloseButton (bool enable)
bool hasCloseButton () const
void setCalendar (Calendar *cal)
DateMap selectedDates ()
IntMap selectedWeekdays ()
WeekMap selectedWeeks ()
DateMap markedDates ()
IntMap markedWeekdays ()
WeekMap markedWeeks ()
void clear ()
void markSelected (int state)

Protected Slots

void dateChangedSlot (QDate)
void tableClickedSlot ()
void monthForwardClicked ()
void monthBackwardClicked ()
void yearForwardClicked ()
void yearBackwardClicked ()
void selectWeekClicked ()
void selectMonthClicked ()
void selectYearClicked ()
void lineEnterPressed ()
void slotWeekdaySelected (int day)
void slotWeekSelected (int week, int year)
void slotSelectionCleared ()

Protected Member Functions

virtual bool eventFilter (QObject *o, QEvent *e)
 to catch move keyEvents when QLineEdit has keyFocus
virtual void resizeEvent (QResizeEvent *)
 the resize event
virtual void virtual_hook (int id, void *data)

Protected Attributes

QToolButton * yearForward
 the year forward button
QToolButton * yearBackward
 the year backward button
QToolButton * monthForward
 the month forward button
QToolButton * monthBackward
 the month backward button
QToolButton * selectMonth
 the button for selecting the month directly
QToolButton * selectYear
 the button for selecting the year directly
QLineEdit * line
 the line edit to enter the date directly
DateValidatorval
 the validator for the line edit:
DateTabletable
 the date table
QSize maxMonthRect

Properties

QDate date []
bool closeButton []

Private Member Functions

void init (const QDate &dt)
int weekOfYear (QDate)

Private Attributes

int fontsize
 the font size for the widget
bool m_selectedDays [7]
CalendarPanelPrivated

Classes

class  CalendarPanelPrivate


Detailed Description

Provides a widget for calendar input.

Definition at line 49 of file kptcalendarpanel.h.


Constructor & Destructor Documentation

KPlato::CalendarPanel::CalendarPanel ( QWidget *  parent = 0,
QDate  = QDate::currentDate(),
const char *  name = 0,
Qt::WFlags  f = 0 
)

The usual constructor. The given date will be displayed initially.

Definition at line 63 of file kptcalendarpanel.cc.

References init().

KPlato::CalendarPanel::CalendarPanel ( QWidget *  parent,
const char *  name 
)

Standard qt widget constructor. The initial date will be the current date.

Definition at line 69 of file kptcalendarpanel.cc.

References init().

KPlato::CalendarPanel::~CalendarPanel (  )  [virtual]

The destructor.

Definition at line 126 of file kptcalendarpanel.cc.

References d.


Member Function Documentation

QSize KPlato::CalendarPanel::sizeHint (  )  const

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.

Definition at line 417 of file kptcalendarpanel.cc.

References KPlato::CalendarPanel::CalendarPanelPrivate::closeButton, d, line, maxMonthRect, monthBackward, monthForward, selectMonth, selectYear, KPlato::DateTable::sizeHint(), table, yearBackward, and yearForward.

Referenced by minimumSizeHint(), and resizeEvent().

QSize KPlato::CalendarPanel::minimumSizeHint (  )  const [inline]

Definition at line 80 of file kptcalendarpanel.h.

References sizeHint().

bool KPlato::CalendarPanel::setDate ( const QDate &   ) 

Sets the date.

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

Definition at line 244 of file kptcalendarpanel.cc.

References d, line, selectMonth, KPlato::CalendarPanel::CalendarPanelPrivate::selectWeek, selectYear, KPlato::DateTable::setDate(), table, and weekOfYear().

Referenced by init(), lineEnterPressed(), monthBackwardClicked(), monthForwardClicked(), selectMonthClicked(), selectWeekClicked(), selectYearClicked(), yearBackwardClicked(), and yearForwardClicked().

const QDate & KPlato::CalendarPanel::getDate (  )  const

Returns the selected date.

Deprecated:

Definition at line 232 of file kptcalendarpanel.cc.

References KPlato::DateTable::getDate(), and table.

const QDate& KPlato::CalendarPanel::date (  )  const

Returns:
the selected date.

Referenced by selectMonthClicked(), selectWeekClicked(), and selectYearClicked().

void KPlato::CalendarPanel::setEnabled ( bool   ) 

Enables or disables the widget.

Definition at line 384 of file kptcalendarpanel.cc.

References d, line, monthBackward, monthForward, selectMonth, KPlato::CalendarPanel::CalendarPanelPrivate::selectWeek, selectYear, KPlato::DateTable::setEnabled(), table, yearBackward, and yearForward.

Referenced by clear(), and setCalendar().

void KPlato::CalendarPanel::setFontSize ( int   ) 

Sets the font size of the widgets elements.

Definition at line 457 of file kptcalendarpanel.cc.

References fontsize, maxMonthRect, selectMonth, selectYear, KPlato::DateTable::setFontSize(), and table.

Referenced by init().

int KPlato::CalendarPanel::fontSize (  )  const [inline]

Returns the font size of the widget elements.

Definition at line 112 of file kptcalendarpanel.h.

References fontsize.

void KPlato::CalendarPanel::setCloseButton ( bool  enable  ) 

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

See also:
hasCloseButton

Definition at line 490 of file kptcalendarpanel.cc.

References KPlato::CalendarPanel::CalendarPanelPrivate::closeButton, and d.

bool KPlato::CalendarPanel::hasCloseButton (  )  const

Returns:
true if a CalendarPanel shows a close-button.
See also:
setCloseButton

Definition at line 510 of file kptcalendarpanel.cc.

References KPlato::CalendarPanel::CalendarPanelPrivate::closeButton, and d.

void KPlato::CalendarPanel::setCalendar ( Calendar cal  ) 

Definition at line 558 of file kptcalendarpanel.cc.

References KPlato::DateTable::addMarkedDate(), KPlato::DateTable::clear(), d, KPlato::Calendar::days(), KPlato::Map::None, setEnabled(), KPlato::DateTable::setMarkedWeekdays(), table, and KPlato::Calendar::weekdaysMap().

Referenced by KPlato::CalendarEdit::setCalendar().

DateMap KPlato::CalendarPanel::selectedDates (  ) 

Definition at line 575 of file kptcalendarpanel.cc.

References KPlato::DateTable::selectedDates(), and table.

Referenced by KPlato::CalendarEdit::slotApplyClicked().

IntMap KPlato::CalendarPanel::selectedWeekdays (  ) 

Definition at line 579 of file kptcalendarpanel.cc.

References KPlato::DateTable::selectedWeekdays(), and table.

Referenced by KPlato::CalendarEdit::slotApplyClicked().

WeekMap KPlato::CalendarPanel::selectedWeeks (  ) 

DateMap KPlato::CalendarPanel::markedDates (  ) 

Definition at line 583 of file kptcalendarpanel.cc.

References KPlato::DateTable::markedDates(), and table.

IntMap KPlato::CalendarPanel::markedWeekdays (  ) 

Definition at line 587 of file kptcalendarpanel.cc.

References KPlato::DateTable::markedWeekdays(), and table.

WeekMap KPlato::CalendarPanel::markedWeeks (  ) 

void KPlato::CalendarPanel::clear (  ) 

Definition at line 591 of file kptcalendarpanel.cc.

References KPlato::DateTable::clear(), setEnabled(), and table.

Referenced by KPlato::CalendarEdit::clearPanel().

void KPlato::CalendarPanel::markSelected ( int  state  ) 

Definition at line 596 of file kptcalendarpanel.cc.

References KPlato::DateTable::markSelected(), and table.

Referenced by KPlato::CalendarEdit::slotApplyClicked().

bool KPlato::CalendarPanel::eventFilter ( QObject *  o,
QEvent *  e 
) [protected, virtual]

to catch move keyEvents when QLineEdit has keyFocus

Definition at line 132 of file kptcalendarpanel.cc.

References table.

void KPlato::CalendarPanel::resizeEvent ( QResizeEvent *   )  [protected, virtual]

the resize event

Definition at line 151 of file kptcalendarpanel.cc.

References KPlato::CalendarPanel::CalendarPanelPrivate::closeButton, d, line, monthBackward, monthForward, selectMonth, KPlato::CalendarPanel::CalendarPanelPrivate::selectWeek, selectYear, sizeHint(), table, yearBackward, and yearForward.

void KPlato::CalendarPanel::dateChangedSlot ( QDate   )  [protected, slot]

Definition at line 213 of file kptcalendarpanel.cc.

References d, dateChanged(), line, selectMonth, KPlato::CalendarPanel::CalendarPanelPrivate::selectWeek, selectYear, and weekOfYear().

Referenced by init().

void KPlato::CalendarPanel::tableClickedSlot (  )  [protected, slot]

Definition at line 224 of file kptcalendarpanel.cc.

References dateSelected(), KPlato::DateTable::getDate(), table, and tableClicked().

Referenced by init().

void KPlato::CalendarPanel::monthForwardClicked (  )  [protected, slot]

Definition at line 263 of file kptcalendarpanel.cc.

References KPlato::DateTable::getDate(), setDate(), and table.

Referenced by init().

void KPlato::CalendarPanel::monthBackwardClicked (  )  [protected, slot]

Definition at line 269 of file kptcalendarpanel.cc.

References KPlato::DateTable::getDate(), setDate(), and table.

Referenced by init().

void KPlato::CalendarPanel::yearForwardClicked (  )  [protected, slot]

Definition at line 275 of file kptcalendarpanel.cc.

References KPlato::DateTable::getDate(), setDate(), and table.

Referenced by init().

void KPlato::CalendarPanel::yearBackwardClicked (  )  [protected, slot]

Definition at line 281 of file kptcalendarpanel.cc.

References KPlato::DateTable::getDate(), setDate(), and table.

Referenced by init().

void KPlato::CalendarPanel::selectWeekClicked (  )  [protected, slot]

Definition at line 287 of file kptcalendarpanel.cc.

References d, date(), KPlato::PopupFrame::exec(), fontsize, KPlato::DateTable::getDate(), KPlato::DateInternalWeekSelector::getWeek(), KPlato::CalendarPanel::CalendarPanelPrivate::selectWeek, setDate(), KPlato::PopupFrame::setMainWidget(), table, and weekOfYear().

Referenced by init().

void KPlato::CalendarPanel::selectMonthClicked (  )  [protected, slot]

Definition at line 324 of file kptcalendarpanel.cc.

References date(), KPlato::PopupFrame::exec(), fontsize, KPlato::DateTable::getDate(), KPlato::DateInternalMonthPicker::getResult(), selectMonth, setDate(), KPlato::PopupFrame::setMainWidget(), KPlato::DateInternalMonthPicker::sizeHint(), and table.

Referenced by init().

void KPlato::CalendarPanel::selectYearClicked (  )  [protected, slot]

Definition at line 354 of file kptcalendarpanel.cc.

References date(), KPlato::PopupFrame::exec(), fontsize, KPlato::DateTable::getDate(), KPlato::DateInternalYearSelector::getYear(), selectMonth, selectYear, setDate(), KPlato::PopupFrame::setMainWidget(), and table.

Referenced by init().

void KPlato::CalendarPanel::lineEnterPressed (  )  [protected, slot]

Definition at line 401 of file kptcalendarpanel.cc.

References KPlato::DateValidator::date(), dateEntered(), line, setDate(), and val.

Referenced by init().

void KPlato::CalendarPanel::slotWeekdaySelected ( int  day  )  [protected, slot]

Definition at line 548 of file kptcalendarpanel.cc.

References weekdaySelected().

Referenced by init().

void KPlato::CalendarPanel::slotWeekSelected ( int  week,
int  year 
) [protected, slot]

Definition at line 553 of file kptcalendarpanel.cc.

References weekSelected().

Referenced by init().

void KPlato::CalendarPanel::slotSelectionCleared (  )  [protected, slot]

Definition at line 600 of file kptcalendarpanel.cc.

References selectionCleared().

Referenced by init().

void KPlato::CalendarPanel::dateChanged ( QDate   )  [signal]

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

Referenced by dateChangedSlot(), and init().

void KPlato::CalendarPanel::dateSelected ( QDate   )  [signal]

This signal is emitted each time a day has been selected by clicking on the table (hitting a day in the current month).

Referenced by tableClickedSlot().

void KPlato::CalendarPanel::dateEntered ( QDate   )  [signal]

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.

Referenced by lineEnterPressed().

void KPlato::CalendarPanel::tableClicked (  )  [signal]

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

Referenced by init(), and tableClickedSlot().

void KPlato::CalendarPanel::weekSelected ( int  week,
int  year 
) [signal]

Referenced by init(), and slotWeekSelected().

void KPlato::CalendarPanel::weekdaySelected ( int  day  )  [signal]

Referenced by init(), and slotWeekdaySelected().

void KPlato::CalendarPanel::selectionCleared (  )  [signal]

All selections have been cleared

Referenced by init(), and slotSelectionCleared().

void KPlato::CalendarPanel::virtual_hook ( int  id,
void *  data 
) [protected, virtual]

Definition at line 604 of file kptcalendarpanel.cc.

void KPlato::CalendarPanel::init ( const QDate &  dt  )  [private]

Definition at line 75 of file kptcalendarpanel.cc.

References d, dateChanged(), dateChangedSlot(), fontsize, line, lineEnterPressed(), monthBackward, monthBackwardClicked(), monthForward, monthForwardClicked(), selectionCleared(), selectMonth, selectMonthClicked(), KPlato::CalendarPanel::CalendarPanelPrivate::selectWeek, selectWeekClicked(), selectYear, selectYearClicked(), setDate(), setFontSize(), slotSelectionCleared(), slotWeekdaySelected(), slotWeekSelected(), table, tableClicked(), tableClickedSlot(), val, weekdaySelected(), weekSelected(), yearBackward, yearBackwardClicked(), yearForward, and yearForwardClicked().

Referenced by CalendarPanel().

int KPlato::CalendarPanel::weekOfYear ( QDate   )  [private]

Definition at line 515 of file kptcalendarpanel.cc.

Referenced by dateChangedSlot(), selectWeekClicked(), and setDate().


Member Data Documentation

QToolButton* KPlato::CalendarPanel::yearForward [protected]

the year forward button

Definition at line 151 of file kptcalendarpanel.h.

Referenced by init(), resizeEvent(), setEnabled(), and sizeHint().

QToolButton* KPlato::CalendarPanel::yearBackward [protected]

the year backward button

Definition at line 153 of file kptcalendarpanel.h.

Referenced by init(), resizeEvent(), setEnabled(), and sizeHint().

QToolButton* KPlato::CalendarPanel::monthForward [protected]

the month forward button

Definition at line 155 of file kptcalendarpanel.h.

Referenced by init(), resizeEvent(), setEnabled(), and sizeHint().

QToolButton* KPlato::CalendarPanel::monthBackward [protected]

the month backward button

Definition at line 157 of file kptcalendarpanel.h.

Referenced by init(), resizeEvent(), setEnabled(), and sizeHint().

QToolButton* KPlato::CalendarPanel::selectMonth [protected]

the button for selecting the month directly

Definition at line 159 of file kptcalendarpanel.h.

Referenced by dateChangedSlot(), init(), resizeEvent(), selectMonthClicked(), selectYearClicked(), setDate(), setEnabled(), setFontSize(), and sizeHint().

QToolButton* KPlato::CalendarPanel::selectYear [protected]

the button for selecting the year directly

Definition at line 161 of file kptcalendarpanel.h.

Referenced by dateChangedSlot(), init(), resizeEvent(), selectYearClicked(), setDate(), setEnabled(), setFontSize(), and sizeHint().

QLineEdit* KPlato::CalendarPanel::line [protected]

the line edit to enter the date directly

Definition at line 163 of file kptcalendarpanel.h.

Referenced by dateChangedSlot(), init(), lineEnterPressed(), resizeEvent(), setDate(), setEnabled(), and sizeHint().

DateValidator* KPlato::CalendarPanel::val [protected]

the validator for the line edit:

Definition at line 165 of file kptcalendarpanel.h.

Referenced by init(), and lineEnterPressed().

DateTable* KPlato::CalendarPanel::table [protected]

the date table

Definition at line 167 of file kptcalendarpanel.h.

Referenced by clear(), eventFilter(), getDate(), init(), markedDates(), markedWeekdays(), markSelected(), monthBackwardClicked(), monthForwardClicked(), resizeEvent(), selectedDates(), selectedWeekdays(), selectMonthClicked(), selectWeekClicked(), selectYearClicked(), setCalendar(), setDate(), setEnabled(), setFontSize(), sizeHint(), tableClickedSlot(), yearBackwardClicked(), and yearForwardClicked().

QSize KPlato::CalendarPanel::maxMonthRect [protected]

Definition at line 169 of file kptcalendarpanel.h.

Referenced by setFontSize(), and sizeHint().

int KPlato::CalendarPanel::fontsize [private]

the font size for the widget

Definition at line 219 of file kptcalendarpanel.h.

Referenced by fontSize(), init(), selectMonthClicked(), selectWeekClicked(), selectYearClicked(), and setFontSize().

bool KPlato::CalendarPanel::m_selectedDays[7] [private]

Definition at line 221 of file kptcalendarpanel.h.

CalendarPanelPrivate* KPlato::CalendarPanel::d [private]

Definition at line 227 of file kptcalendarpanel.h.

Referenced by dateChangedSlot(), hasCloseButton(), init(), resizeEvent(), selectWeekClicked(), setCalendar(), setCloseButton(), setDate(), setEnabled(), sizeHint(), and ~CalendarPanel().


Property Documentation

const QDate & KPlato::CalendarPanel::date [read, write]

Definition at line 52 of file kptcalendarpanel.h.

bool KPlato::CalendarPanel::closeButton [read, write]

Definition at line 53 of file kptcalendarpanel.h.


The documentation for this class was generated from the following files:
Generated on Wed Nov 22 23:21:44 2006 for KPlato by  doxygen 1.5.1-p1