digiKam
Digikam::DDateTable Class Reference
+ Inheritance diagram for Digikam::DDateTable:

Classes

class  Private
 

Public Types

enum  BackgroundMode { NoBgMode = 0 , RectangleMode , CircleMode }
 

Signals

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

Public Member Functions

const QDate & date () const
 
 DDateTable (const QDate &dt, QWidget *const parent=nullptr)
 
 DDateTable (QWidget *const parent=nullptr)
 
bool popupMenuEnabled () const
 
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)
 
QSize sizeHint () const override
 
void unsetCustomDatePainting (const QDate &dt)
 
 ~DDateTable () override
 

Protected Member Functions

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

Properties

QDate date
 
bool popupMenu
 

Friends

class Private
 

Detailed Description

This is a support class for the DDatePicker class. It just draws the calendar 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)

Member Enumeration Documentation

◆ BackgroundMode

Enumerator
NoBgMode 
RectangleMode 
CircleMode 

Constructor & Destructor Documentation

◆ DDateTable() [1/2]

Digikam::DDateTable::DDateTable ( QWidget *const  parent = nullptr)
explicit

◆ DDateTable() [2/2]

Digikam::DDateTable::DDateTable ( const QDate &  dt,
QWidget *const  parent = nullptr 
)
explicit

References date.

◆ ~DDateTable()

Digikam::DDateTable::~DDateTable ( )
override

Member Function Documentation

◆ aboutToShowContextMenu

void Digikam::DDateTable::aboutToShowContextMenu ( QMenu *  menu,
const QDate &  dt 
)
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.

Referenced by mousePressEvent().

◆ date()

const QDate & Digikam::DDateTable::date ( ) const
Returns
the selected date.

References Digikam::DDateTable::Private::date.

◆ dateChanged [1/2]

void Digikam::DDateTable::dateChanged ( const QDate &  cur,
const QDate &  old 
)
signal

This function behaves essentially like the one above. The selected date changed.

Parameters
curThe current date
oldThe date before the date was changed

◆ dateChanged [2/2]

void Digikam::DDateTable::dateChanged ( const QDate &  date)
signal

The selected date changed.

Referenced by setDate().

◆ dateFromPos()

QDate Digikam::DDateTable::dateFromPos ( int  pos)
protectedvirtual

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().

References Digikam::DDateTable::Private::date, DigikamGenericINatPlugin::locale, Digikam::DDateTable::Private::numDayColumns, and Digikam::DDateTable::Private::weekDayFirstOfMonth.

Referenced by mousePressEvent().

◆ event()

bool Digikam::DDateTable::event ( QEvent *  e)
overrideprotected

◆ focusInEvent()

void Digikam::DDateTable::focusInEvent ( QFocusEvent *  e)
overrideprotected

◆ focusOutEvent()

void Digikam::DDateTable::focusOutEvent ( QFocusEvent *  e)
overrideprotected

◆ keyPressEvent()

void Digikam::DDateTable::keyPressEvent ( QKeyEvent *  e)
overrideprotected

◆ mousePressEvent()

◆ paintEvent()

void Digikam::DDateTable::paintEvent ( QPaintEvent *  e)
overrideprotected

◆ popupMenuEnabled()

bool Digikam::DDateTable::popupMenuEnabled ( ) const

Returns if the popup menu is enabled or not

References Digikam::DDateTable::Private::popupMenuEnabled.

◆ posFromDate()

int Digikam::DDateTable::posFromDate ( const QDate &  dt)
protectedvirtual

calculate the position of the cell in the matrix for the given date. The result is the 0-based index.

References date, DigikamGenericINatPlugin::locale, Digikam::DDateTable::Private::numDayColumns, and Digikam::DDateTable::Private::weekDayFirstOfMonth.

◆ setCustomDatePainting()

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

◆ setDate()

bool Digikam::DDateTable::setDate ( const QDate &  date)

◆ setFontSize()

void Digikam::DDateTable::setFontSize ( int  size)

◆ setPopupMenuEnabled()

void Digikam::DDateTable::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.

References Digikam::DDateTable::Private::popupMenuEnabled.

◆ sizeHint()

QSize Digikam::DDateTable::sizeHint ( ) const
override

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.

References Digikam::DDateTable::Private::maxCell, Digikam::DDateTable::Private::numDayColumns, and Digikam::DDateTable::Private::numWeekRows.

◆ tableClicked

void Digikam::DDateTable::tableClicked ( )
signal

A date has been selected by clicking on the table.

Referenced by keyPressEvent(), and mousePressEvent().

◆ unsetCustomDatePainting()

void Digikam::DDateTable::unsetCustomDatePainting ( const QDate &  dt)

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

References Digikam::DDateTable::Private::customPaintingModes, date, and Digikam::DDateTable::Private::useCustomColors.

Referenced by setCustomDatePainting().

◆ wheelEvent()

void Digikam::DDateTable::wheelEvent ( QWheelEvent *  e)
overrideprotected

Friends And Related Function Documentation

◆ Private

friend class Private
friend

Property Documentation

◆ date

◆ popupMenu

bool Digikam::DDateTable::popupMenu
readwrite

The documentation for this class was generated from the following files: