Akonadi Contacts

dateeditwidget.h
1 /*
2  This file is part of Contact Editor.
3 
4  SPDX-FileCopyrightText: 2009 Tobias Koenig <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #pragma once
10 
11 #include <QDate>
12 #include <QLineEdit>
13 #include <QWidget>
14 
15 class KDatePickerPopup;
16 
17 class QContextMenuEvent;
18 class QToolButton;
19 
20 class DateView : public QLineEdit
21 {
22  Q_OBJECT
23 
24 public:
25  explicit DateView(QWidget *parent = nullptr);
26 
27 Q_SIGNALS:
28  void resetDate();
29 
30 protected:
31  void contextMenuEvent(QContextMenuEvent *event) override;
32 
33 private:
34  void emitSignal();
35 };
36 
37 class DateEditWidget : public QWidget
38 {
39  Q_OBJECT
40 
41 public:
42  enum Type { General, Birthday, Anniversary };
43 
44  explicit DateEditWidget(Type type = General, QWidget *parent = nullptr);
45  ~DateEditWidget();
46 
47  void setDate(const QDate &date);
48  Q_REQUIRED_RESULT QDate date() const;
49 
50  void setReadOnly(bool readOnly);
51 
52 private:
53  void dateSelected(const QDate &date);
54  void resetDate();
55  void updateView();
56  DateView *mView = nullptr;
57  QToolButton *mSelectButton = nullptr;
58  QToolButton *mClearButton = nullptr;
59  KDatePickerPopup *mMenu = nullptr;
60  QDate mDate;
61  bool mReadOnly = false;
62 };
63 
virtual void contextMenuEvent(QContextMenuEvent *event) override
Q_SIGNALSQ_SIGNALS
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Jun 18 2021 23:08:56 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.