![]() |
digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
|
This is a support class for the DDatePicker class. More...
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 |
Returns if the popup menu is enabled or not. | |
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 |
Returns a recommended size for the widget. | |
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 |
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)
|
signal |
Connect the slot where you fill the menu to this signal.
const QDate & Digikam::DDateTable::date | ( | ) | const |
|
protectedvirtual |
pos is the 0-based index in the matrix. Inverse function to posForDate().
|
protectedvirtual |
The result is the 0-based index.
|
signal |
The selected date changed.
cur | The current date |
old | The date before the date was changed |
void Digikam::DDateTable::setPopupMenuEnabled | ( | bool | enable | ) |
When it's enabled, this object emits a aboutToShowContextMenu signal where you can fill in the menu items.
|
override |
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.