digiKam
ddateedit.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 : 2002-01-10
7  * Description : a combo box to list date.
8  * this widget come from libkdepim.
9  *
10  * Copyright (C) 2011-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  * Copyright (C) 2002 by Cornelius Schumacher <schumacher at kde dot org>
12  * Copyright (C) 2003-2004 by Reinhold Kainhofer <reinhold at kainhofer dot com>
13  * Copyright (C) 2004 by Tobias Koenig <tokoe at kde dot org>
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)
19  * any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * ============================================================ */
27 
28 #ifndef DIGIKAM_DDATE_EDIT_H
29 #define DIGIKAM_DDATE_EDIT_H
30 
31 // Qt includes
32 
33 #include <QMouseEvent>
34 #include <QEvent>
35 #include <QComboBox>
36 
37 namespace Digikam
38 {
39 
51 class DDateEdit : public QComboBox
52 {
53  Q_OBJECT
54 
55 public:
56 
57  explicit DDateEdit(QWidget* const parent = nullptr, const QString& name = QString());
58  ~DDateEdit() override;
59 
64  QDate date() const;
65 
72  void setReadOnly(bool readOnly);
73 
77  bool isReadOnly() const;
78 
79  void showPopup() override;
80 
81 Q_SIGNALS:
82 
87  void dateChanged(const QDate& date);
88 
89 public Q_SLOTS:
90 
97  void setDate(const QDate& date);
98 
99 protected Q_SLOTS:
100 
101  void lineEnterPressed();
102  void slotTextChanged(const QString&);
103  void dateEntered(const QDate&);
104  void dateSelected(const QDate&);
105 
106 protected:
107 
108  bool eventFilter(QObject*, QEvent*) override;
109  void mousePressEvent(QMouseEvent*) override;
110 
122  virtual bool assignDate(const QDate& date);
123 
128  void setupKeywords();
129 
130 private:
131 
132  QDate parseDate(bool* = nullptr) const;
133  void updateView();
134 
135 private:
136 
137  class Private;
138  Private* const d;
139 };
140 
141 } // namespace Digikam
142 
143 #endif // DIGIKAM_DDATE_EDIT_H
Definition: ddateedit.h:52
void showPopup() override
Definition: ddateedit.cpp:207
void dateSelected(const QDate &)
Definition: ddateedit.cpp:285
void setDate(const QDate &date)
Definition: ddateedit.cpp:185
virtual bool assignDate(const QDate &date)
Definition: ddateedit.cpp:521
void slotTextChanged(const QString &)
Definition: ddateedit.cpp:489
QDate date() const
Definition: ddateedit.cpp:191
void mousePressEvent(QMouseEvent *) override
Definition: ddateedit.cpp:478
void dateEntered(const QDate &)
Definition: ddateedit.cpp:301
void lineEnterPressed()
Definition: ddateedit.cpp:310
void setupKeywords()
Definition: ddateedit.cpp:503
void dateChanged(const QDate &date)
DDateEdit(QWidget *const parent=nullptr, const QString &name=QString())
Definition: ddateedit.cpp:127
bool eventFilter(QObject *, QEvent *) override
Definition: ddateedit.cpp:386
void setReadOnly(bool readOnly)
Definition: ddateedit.cpp:196
bool isReadOnly() const
Definition: ddateedit.cpp:202
~DDateEdit() override
Definition: ddateedit.cpp:178
Definition: datefolderview.cpp:43