KWidgetsAddons

kdatepicker.h
1 /* -*- C++ -*-
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 1997 Tim D. Gilman <[email protected]>
4  SPDX-FileCopyrightText: 1998-2001 Mirko Boehm <[email protected]>
5  SPDX-FileCopyrightText: 2007 John Layt <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.0-or-later
8 */
9 
10 #ifndef KDATEPICKER_H
11 #define KDATEPICKER_H
12 
13 #include <kwidgetsaddons_export.h>
14 
15 #include <QFrame>
16 
17 class QLineEdit;
18 class KDateTable;
19 
41 class KWIDGETSADDONS_EXPORT KDatePicker: public QFrame
42 {
43  Q_OBJECT
44  Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged USER true)
45  Q_PROPERTY(bool closeButton READ hasCloseButton WRITE setCloseButton)
46  Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize)
47 
48 public:
52  explicit KDatePicker(QWidget *parent = nullptr);
53 
57  explicit KDatePicker(const QDate &dt, QWidget *parent = nullptr);
58 
62  ~KDatePicker() override;
63 
70  QSize sizeHint() const override;
71 
77  bool setDate(const QDate &date);
78 
82  const QDate &date() const;
83 
92  void setFontSize(int);
93 
97  int fontSize() const;
98 
107  void setCloseButton(bool enable);
108 
113  bool hasCloseButton() const;
114 
115 protected:
117  bool eventFilter(QObject *o, QEvent *e) override;
119  void resizeEvent(QResizeEvent *) override;
120  void changeEvent(QEvent *event) override;
121 
122 protected Q_SLOTS:
123  void dateChangedSlot(const QDate &date);
124  void tableClickedSlot();
125  void monthForwardClicked();
126  void monthBackwardClicked();
127  void yearForwardClicked();
128  void yearBackwardClicked();
129  void selectMonthClicked();
130  void selectYearClicked();
131  void uncheckYearSelector();
132  void lineEnterPressed();
133  void todayButtonClicked();
134  void weekSelected(int);
135 
136 Q_SIGNALS:
143  void dateChanged(const QDate &date);
144 
150  void dateSelected(const QDate &date);
151 
157  void dateEntered(const QDate &date);
158 
162  void tableClicked();
163 
164 private:
165  KDateTable *dateTable() const;
166  void initWidget(const QDate &date);
167  class KDatePickerPrivate;
168  friend class KDatePickerPrivate;
169  KDatePickerPrivate *const d;
170 };
171 
172 #endif // KDATEPICKER_H
virtual QSize sizeHint() const const override
virtual void changeEvent(QEvent *ev) override
virtual bool eventFilter(QObject *watched, QEvent *event)
Q_PROPERTY(...)
A date selection widget.
Definition: kdatepicker.h:41
virtual void resizeEvent(QResizeEvent *event)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Aug 3 2020 22:43:44 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.