| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Public Types | Signals | Public Member Functions | Protected Member Functions | Properties | Friends | List of all members
Digikam::DDateTable Class Reference

This is a support class for the DDatePicker class. More...

Inheritance diagram for Digikam::DDateTable:

## Public Types
enum | BackgroundMode { NoBgMode = 0 , RectangleMode , CircleMode }

## Signals
void | aboutToShowContextMenu (QMenu *menu, const QDate &dt)
| 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).
void | dateChanged (const QDate &date)
| The selected date changed.
void | selectedDateChanged (const QDate &cur, const QDate &old)
| This signal behaves essentially like the one above.
void | tableClicked ()
| A date has been selected by clicking on the table.

## Public Member Functions
| DDateTable (const QDate &dt, QWidget *const parent=nullptr)
| DDateTable (QWidget *const parent=nullptr)
const QDate & | date () const
bool | popupMenuEnabled () const
void | 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.
bool | setDate (const QDate &date)
| Select and display this date.
void | setFontSize (int size)
| Set the font size of the date table.
void | setPopupMenuEnabled (bool enable)
| Enables a popup menu when right clicking on a date.
QSize | sizeHint () const override
void | unsetCustomDatePainting (const QDate &dt)
| Unsets the custom painting of a date so that the date is painted as usual.

## Protected Member Functions
virtual QDate | dateFromPos (int pos)
| Calculate the date that is displayed at a given cell in the matrix.
bool | event (QEvent *e) override
| Cell highlight on mouse hovering.
void | focusInEvent (QFocusEvent *e) override
void | focusOutEvent (QFocusEvent *e) override
void | keyPressEvent (QKeyEvent *e) override
void | mousePressEvent (QMouseEvent *e) override
| React on mouse clicks that select a date.
void | paintEvent (QPaintEvent *e) override
virtual int | posFromDate (const QDate &dt)
| Calculate the position of the cell in the matrix for the given date.
void | wheelEvent (QWheelEvent *e) override

## Properties
QDate | date
bool | popupMenu

## Friends
class | Private

## Detailed Description

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 Function Documentation

## ◆ aboutToShowContextMenu

void Digikam::DDateTable::aboutToShowContextMenu | ( | QMenu * | menu,
|  | const QDate & | dt
| ) |  |
| signal

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

## ◆ date()

const QDate & Digikam::DDateTable::date | ( |  | ) | const

Returns
  The selected date.

## ◆ dateFromPos()

QDate Digikam::DDateTable::dateFromPos | ( | int | pos | ) |
| protected virtual

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

## ◆ popupMenuEnabled()

bool Digikam::DDateTable::popupMenuEnabled | ( |  | ) | const

Returns
  If the popup menu is enabled or not

## ◆ posFromDate()

int Digikam::DDateTable::posFromDate | ( | const QDate & | dt | ) |
| protected virtual

The result is the 0-based index.

## ◆ selectedDateChanged

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

The selected date changed.

Parameters

  cur | The current date
  old | The date before the date was changed

## ◆ setPopupMenuEnabled()

void Digikam::DDateTable::setPopupMenuEnabled | ( | bool | enable | ) |

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

## ◆ 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.