CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkDateRangeWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Library: CTK
4
5 Copyright (c) Isomics Inc.
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0.txt
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18
19=========================================================================*/
20
21#ifndef __ctkDateRangeWidget_h
22#define __ctkDateRangeWidget_h
23
24// Qt includes
25#include <QDateTimeEdit>
26
27// CTK includes
28#include <ctkPimpl.h>
29
30#include "ctkWidgetsExport.h"
31
32class ctkDateRangeWidgetPrivate;
33class QDateTime;
34
39class CTK_WIDGETS_EXPORT ctkDateRangeWidget : public QWidget
40{
41 Q_OBJECT
42 Q_PROPERTY(QDateTime startDateTime READ startDateTime WRITE setStartDateTime NOTIFY startDateTimeChanged)
43 Q_PROPERTY(QDateTime endDateTime READ endDateTime WRITE setEndDateTime NOTIFY endDateTimeChanged)
44 Q_PROPERTY(bool displayTime READ displayTime WRITE setDisplayTime)
45
46public:
48 typedef QWidget Superclass;
49
54 explicit ctkDateRangeWidget(QWidget* parent = 0);
55
58
63 void setDisplayTime(bool includeTime);
64 bool displayTime()const;
65
69 QDateTime startDateTime() const;
70
74 QDateTime endDateTime() const;
75
79 bool isAnyDate()const;
80
81public Q_SLOTS:
85 void setStartDateTime(QDateTime start);
89 void setEndDateTime(QDateTime end);
92 void setDateTimeRange(QDateTime start, QDateTime end);
93 void setDateRange(QDate start, QDate end);
94
97 void setAnyDate();
98 void setToday();
103
104Q_SIGNALS:
106 void startDateTimeChanged(const QDateTime& value);
108 void endDateTimeChanged(const QDateTime& value);
109
110protected Q_SLOTS:
112
113protected:
114 QScopedPointer<ctkDateRangeWidgetPrivate> d_ptr;
115
116private:
117 Q_DECLARE_PRIVATE(ctkDateRangeWidget);
118 Q_DISABLE_COPY(ctkDateRangeWidget);
119
120};
121
122#endif
virtual ~ctkDateRangeWidget()
Destructor.
void setDisplayTime(bool includeTime)
void setDateTimeRange(QDateTime start, QDateTime end)
Utility function that set the start and end values at once.
void setEndDateTime(QDateTime end)
bool isAnyDate() const
void setAnyDate()
handle clicks on radio buttons
void setDateRange(QDate start, QDate end)
QWidget Superclass
Superclass typedef.
void endDateTimeChanged(const QDateTime &value)
Fired when the end date is changed.
ctkDateRangeWidget(QWidget *parent=0)
void startDateTimeChanged(const QDateTime &value)
Fired when the start date is changed.
bool displayTime() const
void setStartDateTime(QDateTime start)
QScopedPointer< ctkDateRangeWidgetPrivate > d_ptr
QDateTime endDateTime() const
QDateTime startDateTime() const