digiKam
calmonthwidget.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 : 2003-11-03
7  * Description : Calendar month image selection widget.
8  *
9  * Copyright (C) 2003-2005 by Renchi Raju <renchi dot raju at gmail dot com>
10  * Copyright (C) 2006 by Tom Albers <tomalbers at kde dot nl>
11  * Copyright (C) 2007-2008 by Orgad Shaneh <orgads at gmail dot com>
12  * Copyright (C) 2012 by Angelo Naselli <anaselli at linux dot it>
13  * Copyright (C) 2012-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
14  *
15  * This program is free software; you can redistribute it
16  * and/or modify it under the terms of the GNU General
17  * Public License as published by the Free Software Foundation;
18  * either version 2, or (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * ============================================================ */
26 
27 #ifndef DIGIKAM_CAL_MONTH_WIDGET_H
28 #define DIGIKAM_CAL_MONTH_WIDGET_H
29 
30 // Qt includes
31 
32 #include <QPixmap>
33 #include <QPushButton>
34 #include <QUrl>
35 
36 // Local includes
37 
38 #include "loadingdescription.h"
39 #include "thumbnailloadthread.h"
40 
41 class QDragEnterEvent;
42 class QDropEvent;
43 class QMouseEvent;
44 class QPaintEvent;
45 
46 using namespace Digikam;
47 
49 {
50 
51 class CalMonthWidget : public QPushButton
52 {
53  Q_OBJECT
54 
55 public:
56 
57  explicit CalMonthWidget(QWidget* const parent, int month);
58  ~CalMonthWidget() override;
59 
60  QUrl imagePath() const;
61  void setImage(const QUrl& url);
62  int month();
63 
64 Q_SIGNALS:
65 
66  void monthSelected(int);
67 
68 protected:
69 
70  void dragEnterEvent(QDragEnterEvent* e) override;
71  void dropEvent(QDropEvent* e) override;
72  void paintEvent(QPaintEvent* e) override;
73  void mouseReleaseEvent(QMouseEvent* e) override;
74 
75 private Q_SLOTS:
76 
77  void slotThumbnail(const LoadingDescription&, const QPixmap&);
78  void slotMonthSelected();
79 
80 private:
81 
82  QPixmap thumb() const;
83  void setThumb(const QPixmap& pic);
84 
85  Q_PROPERTY(QPixmap thumb READ thumb WRITE setThumb)
86 
87 private:
88 
89  class Private;
90  Private* const d;
91 };
92 
93 } // Namespace Digikam
94 
95 #endif // DIGIKAM_CAL_MONTH_WIDGET_H
Definition: calmonthwidget.h:52
Definition: loadingdescription.h:45
Definition: calendarplugin.cpp:38
Definition: datefolderview.cpp:43