1/* This file is part of the KDE libraries
2 Copyright (C) 2002 Hans Petter bieker <bieker@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*/
18
19#ifndef KDATETIMEWIDGET
20#define KDATETIMEWIDGET
21
22#include <kdeui_export.h>
23
24#include <QtGui/QWidget>
25
26class QDateTime;
27
28/**
29 * @short A combination of a date and a time selection widget.
30 *
31 * This widget can be used to display or allow user selection of date and time.
32 *
33 * @see KDateWidget
34 *
35 * \image html kdatetimewidget.png "KDE Date Time Widget"
36 *
37 * @author Hans Petter Bieker <bieker@kde.org>
38 */
39class KDEUI_EXPORT KDateTimeWidget : public QWidget
40{
41 Q_OBJECT
42 Q_PROPERTY( QDateTime dateTime READ dateTime WRITE setDateTime NOTIFY valueChanged USER true )
43
44public:
45 /**
46 * Constructs a date and time selection widget.
47 */
48 explicit KDateTimeWidget(QWidget * parent = 0);
49
50 /**
51 * Constructs a date and time selection widget with the initial date and
52 * time set to @p datetime.
53 */
54 explicit KDateTimeWidget(const QDateTime & datetime,
55 QWidget * parent = 0);
56
57 /**
58 * Destructs the date and time selection widget.
59 */
60 virtual ~KDateTimeWidget();
61
62 /**
63 * Returns the currently selected date and time.
64 */
65 QDateTime dateTime() const;
66
67public Q_SLOTS:
68 /**
69 * Changes the selected date and time to @p datetime.
70 */
71 void setDateTime(const QDateTime & datetime);
72
73Q_SIGNALS:
74 /**
75 * Emitted whenever the date or time of the widget
76 * is changed, either with setDateTime() or via user selection.
77 */
78 void valueChanged(const QDateTime & datetime);
79
80private:
81 void init();
82
83private Q_SLOTS:
84 void slotValueChanged();
85
86private:
87 class KDateTimeWidgetPrivate;
88 KDateTimeWidgetPrivate * const d;
89};
90
91#endif
92