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)
 This signal is emitted each time the selected date is changed.

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

void dateEntered (QDate)
 This signal is emitted when enter is pressed and a VALID date has been entered before into the line edit.

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


Public Methods

 KDatePicker (QWidget *parent=0, QDate=QDate::currentDate(), const char *name=0)
 The usual constructor.

 KDatePicker (QWidget *parent, QDate, const char *name, WFlags f)
 The usual constructor.

 KDatePicker (QWidget *parent, const char *name)
 Standard qt widget constructor.

virtual ~KDatePicker ()
 The destructor.

QSize sizeHint () const
 The size hint for date pickers.

bool setDate (const QDate &)
 Sets the date.

const QDategetDate () const
 Returns the selected date.

const QDatedate () const
void setEnabled (bool)
 Enables or disables the widget.

void setFontSize (int)
 Sets the font size of the widgets elements.

int fontSize () const
 Returns the font size of the widget elements.

void setCloseButton (bool enable)
 By calling this method with enable = true, KDatePicker will show a little close-button in the upper button-row.

bool hasCloseButton () const

Protected Slots

void selectWeekClicked ()
 
Since:
3.1



Protected Methods

virtual bool eventFilter (QObject *o, QEvent *e)
 to catch move keyEvents when QLineEdit has keyFocus

virtual void resizeEvent (QResizeEvent *)
 the resize event


Protected Attributes

QToolButtonyearForward
 the year forward button

QToolButtonyearBackward
 the year backward button

QToolButtonmonthForward
 the month forward button

QToolButtonmonthBackward
 the month backward button

QToolButtonselectMonth
 the button for selecting the month directly

QToolButtonselectYear
 the button for selecting the year directly

QLineEditline
 the line edit to enter the date directly

KDateValidatorval
 the validator for the line edit:

KDateTabletable
 the date table

QSize maxMonthRect
 the widest month string in pixels:


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.30 2002/09/28 15:16:22 tjansen Exp
Author:
Tim Gilman, Mirko Boehm

Definition at line 49 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 50 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 56 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 62 of file kdatepicker.cpp.

References QDate::currentDate().

KDatePicker::~KDatePicker   [virtual]
 

The destructor.

Definition at line 114 of file kdatepicker.cpp.


Member Function Documentation

QSize KDatePicker::sizeHint  
 

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 396 of file kdatepicker.cpp.

References QSize::height(), line, maxMonthRect, monthBackward, monthForward, selectMonth, selectYear, QLineEdit::sizeHint(), QWidget::sizeHint(), KDateTable::sizeHint(), QApplication::style(), table, QSize::width(), yearBackward, and yearForward.

bool KDatePicker::setDate const QDate  
 

Sets the date.

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

Definition at line 224 of file kdatepicker.cpp.

References QDate::isValid(), line, KGlobal::locale(), QDate::month(), selectMonth, selectYear, KDateTable::setDate(), QString::setNum(), QLineEdit::setText(), table, and QDate::year().

Referenced by selectWeekClicked().

const QDate & KDatePicker::getDate  
 

Returns the selected date.

Deprecated:

Definition at line 212 of file kdatepicker.cpp.

References KDateTable::getDate(), and table.

const QDate & KDatePicker::date  
 

Returns:
the selected date.

Definition at line 218 of file kdatepicker.cpp.

References KDateTable::getDate(), and table.

void KDatePicker::setEnabled bool   
 

Enables or disables the widget.

Definition at line 364 of file kdatepicker.cpp.

References line, monthBackward, monthForward, selectMonth, selectYear, QWidget::setEnabled(), table, yearBackward, and yearForward.

void KDatePicker::setFontSize int   
 

Sets the font size of the widgets elements.

Definition at line 436 of file kdatepicker.cpp.

References QFontMetrics::boundingRect(), QWidget::font(), QSize::height(), QRect::height(), KGlobal::locale(), maxMonthRect, selectMonth, selectYear, QWidget::setFont(), KDateTable::setFontSize(), QSize::setHeight(), QFont::setPointSize(), QSize::setWidth(), table, QSize::width(), and QRect::width().

int KDatePicker::fontSize   const [inline]
 

Returns the font size of the widget elements.

Definition at line 123 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 469 of file kdatepicker.cpp.

References QToolTip::add().

bool KDatePicker::hasCloseButton  
 

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

Definition at line 489 of file kdatepicker.cpp.

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

to catch move keyEvents when QLineEdit has keyFocus

Definition at line 120 of file kdatepicker.cpp.

References QKeyEvent::key(), QApplication::sendEvent(), table, and QEvent::type().

void KDatePicker::resizeEvent QResizeEvent   [protected, virtual]
 

the resize event

Reimplemented from QFrame.

Definition at line 139 of file kdatepicker.cpp.

References line, maxMonthRect, monthBackward, monthForward, selectMonth, selectYear, QWidget::setGeometry(), QSize::setWidth(), QLineEdit::sizeHint(), QWidget::sizeHint(), QApplication::style(), table, QSize::width(), yearBackward, and yearForward.

void KDatePicker::selectWeekClicked   [protected, slot]
 

Since:
3.1

Definition at line 267 of file kdatepicker.cpp.

References QDate::addDays(), KNotifyClient::beep(), KPopupFrame::exec(), KDateTable::getDate(), KDateInternalWeekSelector::getWeek(), setDate(), KPopupFrame::setMainWidget(), QDate::setYMD(), QLineEdit::sizeHint(), table, and QDate::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.

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 150 of file kdatepicker.h.

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

QToolButton* KDatePicker::yearBackward [protected]
 

the year backward button

Definition at line 152 of file kdatepicker.h.

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

QToolButton* KDatePicker::monthForward [protected]
 

the month forward button

Definition at line 154 of file kdatepicker.h.

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

QToolButton* KDatePicker::monthBackward [protected]
 

the month backward button

Definition at line 156 of file kdatepicker.h.

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

QToolButton* KDatePicker::selectMonth [protected]
 

the button for selecting the month directly

Definition at line 158 of file kdatepicker.h.

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

QToolButton* KDatePicker::selectYear [protected]
 

the button for selecting the year directly

Definition at line 160 of file kdatepicker.h.

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

QLineEdit* KDatePicker::line [protected]
 

the line edit to enter the date directly

Definition at line 162 of file kdatepicker.h.

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

KDateValidator* KDatePicker::val [protected]
 

the validator for the line edit:

Definition at line 164 of file kdatepicker.h.

KDateTable* KDatePicker::table [protected]
 

the date table

Definition at line 166 of file kdatepicker.h.

Referenced by date(), eventFilter(), getDate(), resizeEvent(), selectWeekClicked(), setDate(), setEnabled(), setFontSize(), and sizeHint().

QSize KDatePicker::maxMonthRect [protected]
 

the widest month string in pixels:

Definition at line 170 of file kdatepicker.h.

Referenced by resizeEvent(), setFontSize(), and sizeHint().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:03 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001