KDELibs4Support

kdatewidget.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2001 Waldo Bastian ([email protected])
3  Copyright (c) 2007 John Layt <[email protected]>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef KDATEWIDGET_H
21 #define KDATEWIDGET_H
22 
23 #include <kdelibs4support_export.h>
24 
25 #include <QWidget>
26 
27 #include "klocale.h"
28 
29 class KCalendarSystem;
30 
31 class QDate;
32 
33 /**
34  * @short A date selection widget.
35  *
36  * This widget can be used to display or allow user selection of a date.
37  *
38  * \image html kdatewidget.png "KDE Date Widget"
39  *
40  * @see KDatePicker
41  *
42  * @author Waldo Bastian <[email protected]>, John Layt <[email protected]>
43  */
44 class KDELIBS4SUPPORT_EXPORT KDateWidget : public QWidget
45 {
46  Q_OBJECT
47  Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY changed USER true)
48 //FIXME Q_PROPERTY( KCalendarSystem calendar READ calendar WRITE setCalendar USER true )
49 
50 public:
51  /**
52  * Constructs a date selection widget.
53  */
54  KDELIBS4SUPPORT_DEPRECATED explicit KDateWidget(QWidget *parent = nullptr);
55 
56  /**
57  * Constructs a date selection widget with the initial date set to @p date.
58  */
59  KDELIBS4SUPPORT_DEPRECATED explicit KDateWidget(const QDate &date, QWidget *parent = nullptr);
60 
61  /**
62  * Destructs the date selection widget.
63  */
64  ~KDateWidget() override;
65 
66  // KDE5 remove const &
67  /**
68  * Returns the currently selected date.
69  */
70  const QDate &date() const;
71 
72  /**
73  * Changes the selected date to @p date.
74  *
75  * @return @c true if the date was successfully set, @c false otherwise
76  */
77  bool setDate(const QDate &date);
78 
79  /**
80  * Returns the currently selected calendar system.
81  *
82  * @return a KCalendarSystem object
83  */
84  const KCalendarSystem *calendar() const;
85 
86  /**
87  * Changes the calendar system to use. Can use its own local locale if set.
88  *
89  * @param calendar the calendar system object to use, defaults to global
90  *
91  * @return @c true if the calendar system was successfully set, @c false otherwise
92  */
93  bool setCalendar(KCalendarSystem *calendar = nullptr);
94 
95  /**
96  * @since 4.6
97  *
98  * Changes the calendar system to use. Will always use global locale.
99  *
100  * @param calendarSystem the calendar system to use
101  * @return @c true if the calendar system was successfully set, @c false otherwise
102  */
103  bool setCalendarSystem(KLocale::CalendarSystem calendarSystem);
104 
105 Q_SIGNALS:
106  /**
107  * Emitted whenever the date of the widget
108  * is changed, either with setDate() or via user selection.
109  */
110  void changed(const QDate &date);
111 
112 protected:
113  void initWidget(const QDate &date);
114 
115 protected Q_SLOTS:
116  void slotDateChanged();
117 
118 private:
119  class KDateWidgetPrivate;
120  KDateWidgetPrivate *const d;
121 };
122 
123 #endif // KDATEWIDGET_H
124 
KCalendarSystem abstract base class, provides support for local Calendar Systems in KDE...
CalendarSystem
Definition: klocale.h:646
A date selection widget.
Definition: kdatewidget.h:44
Q_PROPERTY(...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Jun 17 2021 22:58:15 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.