• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

KDateTable Class Reference

#include <kdatetable.h>

Inheritance diagram for KDateTable:

Inheritance graph
[legend]

List of all members.


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)

For internal use only.

Author:
Tim Gilman, Mirko Boehm

Definition at line 134 of file kdatetable.h.


Public Types

enum  BackgroundMode { NoBgMode = 0, RectangleMode, CircleMode }

Signals

void aboutToShowContextMenu (KMenu *menu, const QDate &date)
void dateChanged (const QDate &cur, const QDate &old)
void dateChanged (const QDate &date)
void tableClicked ()

Public Member Functions

const KCalendarSystem * calendar () const
const QDate & date () const
 KDateTable (const QDate &, QWidget *parent=0)
 KDateTable (QWidget *parent=0)
bool popupMenuEnabled () const
bool setCalendar (const QString &calendarType)
bool setCalendar (KCalendarSystem *calendar=0)
void setCustomDatePainting (const QDate &date, const QColor &fgColor, BackgroundMode bgMode=NoBgMode, const QColor &bgColor=QColor())
bool setDate (const QDate &date)
void setFontSize (int size)
void setPopupMenuEnabled (bool enable)
virtual QSize sizeHint () const
void unsetCustomDatePainting (const QDate &date)
 ~KDateTable ()

Protected Member Functions

virtual QDate dateFromPos (int pos)
virtual void focusInEvent (QFocusEvent *e)
virtual void focusOutEvent (QFocusEvent *e)
virtual void keyPressEvent (QKeyEvent *e)
virtual void mousePressEvent (QMouseEvent *e)
virtual void paintEvent (QPaintEvent *e)
virtual int posFromDate (const QDate &date)
virtual void wheelEvent (QWheelEvent *e)

Properties

QDate date
bool popupMenu

Member Enumeration Documentation

enum KDateTable::BackgroundMode

Enumerator:
NoBgMode 
RectangleMode 
CircleMode 

Definition at line 219 of file kdatetable.h.


Constructor & Destructor Documentation

KDateTable::KDateTable ( QWidget *  parent = 0  )  [explicit]

The constructor.

Definition at line 210 of file kdatetable.cpp.

KDateTable::KDateTable ( const QDate &  date_,
QWidget *  parent = 0 
) [explicit]

The constructor.

Definition at line 192 of file kdatetable.cpp.

KDateTable::~KDateTable (  ) 

The destructor.

Definition at line 227 of file kdatetable.cpp.


Member Function Documentation

void KDateTable::aboutToShowContextMenu ( KMenu *  menu,
const QDate &  date 
) [signal]

A popup menu for a given date is about to be shown (as when the user right clicks on that date and the popup menu is enabled).

Connect the slot where you fill the menu to this signal.

const KCalendarSystem * KDateTable::calendar (  )  const

Returns the currently selected calendar system.

Returns:
a KCalendarSystem object

Definition at line 669 of file kdatetable.cpp.

const QDate& KDateTable::date (  )  const

Returns:
the selected date.

void KDateTable::dateChanged ( const QDate &  cur,
const QDate &  old 
) [signal]

This function behaves essentially like the one above.

The selected date changed.

Parameters:
cur The current date
old The date before the date was changed

void KDateTable::dateChanged ( const QDate &  date  )  [signal]

The selected date changed.

QDate KDateTable::dateFromPos ( int  pos  )  [protected, virtual]

calculate the date that is displayed at a given cell in the matrix.

pos is the 0-based index in the matrix. Inverse function to posForDate().

Definition at line 280 of file kdatetable.cpp.

void KDateTable::focusInEvent ( QFocusEvent *  e  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 718 of file kdatetable.cpp.

void KDateTable::focusOutEvent ( QFocusEvent *  e  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 723 of file kdatetable.cpp.

void KDateTable::keyPressEvent ( QKeyEvent *  e  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 499 of file kdatetable.cpp.

void KDateTable::mousePressEvent ( QMouseEvent *  e  )  [protected, virtual]

React on mouse clicks that select a date.

Reimplemented from QWidget.

Definition at line 574 of file kdatetable.cpp.

void KDateTable::paintEvent ( QPaintEvent *  e  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 303 of file kdatetable.cpp.

bool KDateTable::popupMenuEnabled (  )  const

Returns if the popup menu is enabled or not.

Definition at line 744 of file kdatetable.cpp.

int KDateTable::posFromDate ( const QDate &  date  )  [protected, virtual]

calculate the position of the cell in the matrix for the given date.

The result is the 0-based index.

Definition at line 266 of file kdatetable.cpp.

bool KDateTable::setCalendar ( const QString &  calendarType  ) 

Changes the calendar system to use.

Will always use global locale.

Parameters:
calendarType the calendar system type to use
Returns:
true if the calendar system was successfully set, false otherwise

Definition at line 703 of file kdatetable.cpp.

bool KDateTable::setCalendar ( KCalendarSystem *  calendar = 0  ) 

Changes the calendar system to use.

Can use its own local locale if set.

Parameters:
calendar the calendar system object to use, defaults to global
Returns:
true if the calendar system was successfully set, false otherwise

Definition at line 678 of file kdatetable.cpp.

void KDateTable::setCustomDatePainting ( const QDate &  date,
const QColor &  fgColor,
BackgroundMode  bgMode = NoBgMode,
const QColor &  bgColor = QColor() 
)

Makes a given date be painted with a given foregroundColor, and background (a rectangle, or a circle/ellipse) in a given color.

Definition at line 749 of file kdatetable.cpp.

bool KDateTable::setDate ( const QDate &  date  ) 

Select and display this date.

Definition at line 626 of file kdatetable.cpp.

void KDateTable::setFontSize ( int  size  ) 

Set the font size of the date table.

Definition at line 547 of file kdatetable.cpp.

void KDateTable::setPopupMenuEnabled ( bool  enable  ) 

Enables a popup menu when right clicking on a date.

When it's enabled, this object emits a aboutToShowContextMenu signal where you can fill in the menu items.

Definition at line 739 of file kdatetable.cpp.

QSize KDateTable::sizeHint ( void   )  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 728 of file kdatetable.cpp.

void KDateTable::tableClicked (  )  [signal]

A date has been selected by clicking on the table.

void KDateTable::unsetCustomDatePainting ( const QDate &  date  ) 

Unsets the custom painting of a date so that the date is painted as usual.

Definition at line 766 of file kdatetable.cpp.

void KDateTable::wheelEvent ( QWheelEvent *  e  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 568 of file kdatetable.cpp.


Property Documentation

const QDate & KDateTable::date [read, write]

Definition at line 137 of file kdatetable.h.

bool KDateTable::popupMenu [read, write]

Definition at line 139 of file kdatetable.h.


The documentation for this class was generated from the following files:
  • kdatetable.h
  • kdatetable.cpp

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal