CCIMXDesktop
 
Loading...
Searching...
No Matches
DateIcon.h
1#ifndef DATEICON_H
2#define DATEICON_H
3
4#include <QDate>
5#include <QWidget>
6
13class DateIcon : public QWidget {
14 Q_OBJECT
15public:
20 explicit DateIcon(QWidget* parent = nullptr);
21
26 QSize sizeHint() const override;
27
33 int heightForWidth(int width) const override;
34
43 static QPixmap generateCalendarIcon(int width, int height,
44 const QDate& date,
45 bool darkMode = false);
46
51 void setHandleDate(const QDate& date) { handling_date = date; }
52
57 QDate handleDate() const { return handling_date; }
58
59protected:
64 void paintEvent(QPaintEvent* event) override;
65
66private:
67 QDate handling_date;
68};
69
70#endif // DATEICON_H
A widget that displays a date in an icon-like format.
Definition DateIcon.h:13
int heightForWidth(int width) const override
Calculates height for a given width.
Definition DateIcon.cpp:14
static QPixmap generateCalendarIcon(int width, int height, const QDate &date, bool darkMode=false)
Generates a calendar icon pixmap.
Definition DateIcon.cpp:18
QSize sizeHint() const override
Gets the recommended size for the widget.
Definition DateIcon.cpp:89
void paintEvent(QPaintEvent *event) override
Handles paint events.
Definition DateIcon.cpp:59
void setHandleDate(const QDate &date)
Sets the date to display.
Definition DateIcon.h:51
QDate handleDate() const
Gets the current display date.
Definition DateIcon.h:57