digiKam
ddatepicker.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 : 1997-04-21
7  * Description : A date selection widget.
8  *
9  * Copyright (C) 2011-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 1997 by Tim D. Gilman <tdgilman at best dot org>
11  * Copyright (C) 1998-2001 by Mirko Boehm <mirko at kde dot org>
12  * Copyright (C) 2007 by John Layt <john at layt dot net>
13  *
14  * This program is free software; you can redistribute it
15  * and/or modify it under the terms of the GNU General
16  * Public License as published by the Free Software Foundation;
17  * either version 2, or (at your option)
18  * 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_DDATE_PICKER_H
28 #define DIGIKAM_DDATE_PICKER_H
29 
30 // Qt includes
31 
32 #include <QDateTime>
33 #include <QFrame>
34 
35 // Local includes
36 
37 #include "digikam_export.h"
38 
39 class QLineEdit;
40 
41 namespace Digikam
42 {
43 
44 class DDateTable;
45 
49 class DIGIKAM_GUI_EXPORT DDatePicker : public QFrame
50 {
51  Q_OBJECT
52  Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged USER true)
53  Q_PROPERTY(bool closeButton READ hasCloseButton WRITE setCloseButton)
54  Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize)
55 
56 public:
57 
61  explicit DDatePicker(QWidget* const parent = nullptr);
62 
66  explicit DDatePicker(const QDate& dt, QWidget* const parent = nullptr);
67 
71  ~DDatePicker() override;
72 
80  QSize sizeHint() const override;
81 
87  bool setDate(const QDate& date);
88 
92  const QDate& date() const;
93 
98  DDateTable* dateTable() const;
99 
103  void setFontSize(int);
104 
108  int fontSize() const;
109 
118  void setCloseButton(bool enable);
119 
124  bool hasCloseButton() const;
125 
126 protected:
127 
129  bool eventFilter(QObject*, QEvent*) override;
130 
132  void resizeEvent(QResizeEvent*) override;
133  void changeEvent(QEvent*) override;
134 
135 protected Q_SLOTS:
136 
137  void dateChangedSlot(const QDate& date);
138  void tableClickedSlot();
139  void monthForwardClicked();
140  void monthBackwardClicked();
141  void yearForwardClicked();
142  void yearBackwardClicked();
143  void selectMonthClicked();
144  void selectYearClicked();
145  void uncheckYearSelector();
146  void lineEnterPressed();
147  void todayButtonClicked();
148  void weekSelected(int);
149 
150 Q_SIGNALS:
151 
159  void dateChanged(const QDate& date);
160 
167  void dateSelected(const QDate& date);
168 
175  void dateEntered(const QDate& date);
176 
181  void tableClicked();
182 
183 private:
184 
185  void initWidget(const QDate& date);
186 
187 private:
188 
189  class Private;
190  Private* const d;
191 
192  friend class Private;
193 };
194 
195 } // namespace Digikam
196 
197 #endif // DIGIKAM_DDATE_PICKER_H
Definition: ddatepicker_p.h:99
Definition: ddatepicker.h:50
void dateEntered(const QDate &date)
void dateChanged(const QDate &date)
void dateSelected(const QDate &date)
Definition: ddatetable.h:50
Definition: datefolderview.cpp:43