kdeui Library API Documentation

KDatePicker Class Reference

Provides a widget for calendar date input. A date selection widget. More...

#include <kdatepicker.h>

Inheritance diagram for KDatePicker:

QFrame List of all members.

Signals

void dateChanged (QDate)
void dateSelected (QDate)
void dateEntered (QDate)
void tableClicked ()

Public Member Functions

 KDatePicker (QWidget *parent=0, QDate=QDate::currentDate(), const char *name=0)
 KDatePicker (QWidget *parent, QDate, const char *name, WFlags f)
 KDatePicker (QWidget *parent, const char *name)
virtual ~KDatePicker ()
QSize sizeHint () const
bool setDate (const QDate &)
const QDategetDate () const KDE_DEPRECATED
const QDatedate () const
void setEnabled (bool)
KDateTabledateTable () const
void setFontSize (int)
int fontSize () const
void setCloseButton (bool enable)
bool hasCloseButton () const

Protected Slots

void dateChangedSlot (QDate)
void tableClickedSlot ()
void monthForwardClicked ()
void monthBackwardClicked ()
void yearForwardClicked ()
void yearBackwardClicked ()
void selectWeekClicked ()
void selectMonthClicked ()
void selectYearClicked ()
void lineEnterPressed ()
void todayButtonClicked ()
void weekSelected (int)

Protected Member Functions

virtual bool eventFilter (QObject *o, QEvent *e)
virtual void resizeEvent (QResizeEvent *)
virtual void virtual_hook (int id, void *data)

Protected Attributes

QToolButtonyearForward
QToolButtonyearBackward
QToolButtonmonthForward
QToolButtonmonthBackward
QToolButtonselectMonth
QToolButtonselectYear
QLineEditline
KDateValidatorval
KDateTabletable
QSize maxMonthRect

Properties

QDate date
bool closeButton
int fontSize

Detailed Description

Provides a widget for calendar date input. A date selection widget.

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.

kdatepicker.png

KDE Date Widget

Version:
Id
kdatepicker.h,v 1.40 2004/01/21 16:16:10 raabe Exp
Author:
Tim Gilman, Mirko Boehm

Definition at line 50 of file kdatepicker.h.


Constructor & Destructor Documentation

KDatePicker::KDatePicker QWidget parent = 0,
QDate  = QDate::currentDate(),
const char *  name = 0
 

The usual constructor.

The given date will be displayed initially.

Definition at line 90 of file kdatepicker.cpp.

KDatePicker::KDatePicker QWidget parent,
QDate  ,
const char *  name,
WFlags  f
 

The usual constructor.

The given date will be displayed initially.

Since:
3.1

Definition at line 96 of file kdatepicker.cpp.

KDatePicker::KDatePicker QWidget parent,
const char *  name
 

Standard qt widget constructor.

The initial date will be the current date.

Since:
3.1

Definition at line 102 of file kdatepicker.cpp.

KDatePicker::~KDatePicker  )  [virtual]
 

The destructor.

Definition at line 206 of file kdatepicker.cpp.


Member Function Documentation

QSize KDatePicker::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 450 of file kdatepicker.cpp.

bool KDatePicker::setDate const QDate  ) 
 

Sets the date.

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

Definition at line 277 of file kdatepicker.cpp.

References kdDebug(), KDateTable::setDate(), and table.

Referenced by lineEnterPressed(), selectMonthClicked(), selectYearClicked(), todayButtonClicked(), and weekSelected().

const QDate & KDatePicker::getDate  )  const
 

Returns the selected date.

Deprecated:

Definition at line 265 of file kdatepicker.cpp.

References KDateTable::getDate(), and table.

const QDate& KDatePicker::date  )  const
 

Returns:
the selected date.

void KDatePicker::setEnabled bool   ) 
 

Enables or disables the widget.

Definition at line 412 of file kdatepicker.cpp.

KDateTable* KDatePicker::dateTable  )  const [inline]
 

Returns:
the KDateTable widget child of this KDatePicker widget.
Since:
3.2

Definition at line 123 of file kdatepicker.h.

void KDatePicker::setFontSize int   ) 
 

Sets the font size of the widgets elements.

Definition at line 456 of file kdatepicker.cpp.

References KLocale::calendar(), KDateTable::getDate(), KGlobal::locale(), maxMonthRect, KCalendarSystem::monthName(), selectMonth, KDateTable::setFontSize(), and table.

int KDatePicker::fontSize  )  const [inline]
 

Returns the font size of the widget elements.

Definition at line 132 of file kdatepicker.h.

void KDatePicker::setCloseButton 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
Since:
3.1

Definition at line 499 of file kdatepicker.cpp.

bool KDatePicker::hasCloseButton  )  const
 

Returns:
true if a KDatePicker shows a close-button.
See also:
setCloseButton
Since:
3.1

Definition at line 522 of file kdatepicker.cpp.

bool KDatePicker::eventFilter QObject o,
QEvent e
[protected, virtual]
 

to catch move keyEvents when QLineEdit has keyFocus

Definition at line 212 of file kdatepicker.cpp.

References table.

void KDatePicker::resizeEvent QResizeEvent  )  [protected, virtual]
 

the resize event

Definition at line 231 of file kdatepicker.cpp.

void KDatePicker::selectWeekClicked  )  [protected, slot]
 

Since:
3.1

Deprecated:
in 3.2

Definition at line 327 of file kdatepicker.cpp.

void KDatePicker::selectMonthClicked  )  [protected, slot]
 

Since:
3.1

Definition at line 346 of file kdatepicker.cpp.

References KLocale::calendar(), KCalendarSystem::day(), KCalendarSystem::daysInMonth(), KDateTable::getDate(), KGlobal::locale(), KCalendarSystem::month(), KCalendarSystem::monthName(), KCalendarSystem::monthsInYear(), selectMonth, setDate(), KCalendarSystem::setYMD(), table, and KCalendarSystem::year().

void KDatePicker::selectYearClicked  )  [protected, slot]
 

Since:
3.1

Definition at line 373 of file kdatepicker.cpp.

References KNotifyClient::beep(), KLocale::calendar(), KCalendarSystem::day(), KCalendarSystem::daysInMonth(), KPopupFrame::exec(), KDateTable::getDate(), KDateInternalYearSelector::getYear(), KGlobal::locale(), KCalendarSystem::month(), selectMonth, selectYear, setDate(), KPopupFrame::setMainWidget(), KCalendarSystem::setYMD(), and table.

void KDatePicker::lineEnterPressed  )  [protected, slot]
 

Since:
3.1

Definition at line 428 of file kdatepicker.cpp.

References KNotifyClient::beep(), KDateValidator::date(), dateEntered(), kdDebug(), line, setDate(), and val.

void KDatePicker::todayButtonClicked  )  [protected, slot]
 

Since:
3.2

Definition at line 444 of file kdatepicker.cpp.

References setDate().

void KDatePicker::weekSelected int   )  [protected, slot]
 

Since:
3.2

Definition at line 330 of file kdatepicker.cpp.

References KCalendarSystem::addDays(), KLocale::calendar(), KCalendarSystem::dayOfWeek(), KDateTable::getDate(), KGlobal::locale(), setDate(), KCalendarSystem::setYMD(), table, and KCalendarSystem::year().

void KDatePicker::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

void KDatePicker::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).

It has the same meaning as dateSelected() in older versions of KDatePicker.

void KDatePicker::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 KDatePicker::tableClicked  )  [signal]
 

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


Member Data Documentation

QToolButton* KDatePicker::yearForward [protected]
 

the year forward button

Definition at line 159 of file kdatepicker.h.

QToolButton* KDatePicker::yearBackward [protected]
 

the year backward button

Definition at line 161 of file kdatepicker.h.

QToolButton* KDatePicker::monthForward [protected]
 

the month forward button

Definition at line 163 of file kdatepicker.h.

QToolButton* KDatePicker::monthBackward [protected]
 

the month backward button

Definition at line 165 of file kdatepicker.h.

QToolButton* KDatePicker::selectMonth [protected]
 

the button for selecting the month directly

Definition at line 167 of file kdatepicker.h.

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

QToolButton* KDatePicker::selectYear [protected]
 

the button for selecting the year directly

Definition at line 169 of file kdatepicker.h.

Referenced by selectYearClicked().

QLineEdit* KDatePicker::line [protected]
 

the line edit to enter the date directly

Definition at line 171 of file kdatepicker.h.

Referenced by lineEnterPressed().

KDateValidator* KDatePicker::val [protected]
 

the validator for the line edit:

Definition at line 173 of file kdatepicker.h.

Referenced by lineEnterPressed().

KDateTable* KDatePicker::table [protected]
 

the date table

Definition at line 175 of file kdatepicker.h.

Referenced by eventFilter(), getDate(), selectMonthClicked(), selectYearClicked(), setDate(), setFontSize(), and weekSelected().

QSize KDatePicker::maxMonthRect [protected]
 

the widest month string in pixels:

Definition at line 179 of file kdatepicker.h.

Referenced by setFontSize().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdeui Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Feb 18 15:10:21 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003