digiKam
monthwidget.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2005-05-02
7  * Description : a widget to perform month selection.
8  *
9  * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
10  * Copyright (C) 2006-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_MONTH_WIDGET_H
26 #define DIGIKAM_MONTH_WIDGET_H
27 
28 // Qt includes
29 
30 #include <QWidget>
31 
32 // Local includes
33 
34 #include "iteminfo.h"
35 
36 class QResizeEvent;
37 class QPaintEvent;
38 class QMouseEvent;
39 
40 namespace Digikam
41 {
42 class ItemFilterModel;
43 
44 class MonthWidget : public QWidget
45 {
46  Q_OBJECT
47 
48 public:
49 
50  explicit MonthWidget(QWidget* const parent);
51  ~MonthWidget() override;
52 
53  void setItemModel(ItemFilterModel* const model);
54 
55  void setYearMonth(int year, int month);
56  QSize sizeHint() const override;
57 
58  void setActive(bool val);
59 
60 protected:
61 
62  void resizeEvent(QResizeEvent* e) override;
63  void paintEvent(QPaintEvent*) override;
64  void mousePressEvent(QMouseEvent* e) override;
65 
66 private:
67 
68  void init();
69 
70 private Q_SLOTS:
71 
72  void triggerUpdateDays();
73  void updateDays();
74  void slotModelDestroyed();
75 
76 private:
77 
78  void resetDayCounts();
79  void connectModel();
80 
81 private:
82 
83  class Private;
84  Private* const d;
85 };
86 
87 } // namespace Digikam
88 
89 #endif // DIGIKAM_MONTH_WIDGET_H
Definition: itemfiltermodel.h:125
Definition: monthwidget.h:45
void setActive(bool val)
Definition: monthwidget.cpp:397
void resizeEvent(QResizeEvent *e) override
Definition: monthwidget.cpp:172
QSize sizeHint() const override
Definition: monthwidget.cpp:167
void paintEvent(QPaintEvent *) override
Definition: monthwidget.cpp:180
void mousePressEvent(QMouseEvent *e) override
Definition: monthwidget.cpp:295
void setItemModel(ItemFilterModel *const model)
Definition: monthwidget.cpp:424
~MonthWidget() override
Definition: monthwidget.cpp:122
void setYearMonth(int year, int month)
Definition: monthwidget.cpp:143
MonthWidget(QWidget *const parent)
Definition: monthwidget.cpp:103
Definition: datefolderview.cpp:43