diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-09-12 21:14:16 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2014-09-23 15:30:45 +0200 |
commit | 356ab736a7ab81ffbc04a951d4470cede6e9b1f5 (patch) | |
tree | 999a08430917cf1abf0241ac47e57d1d0161294a /src/widgets/widgets/qcalendarwidget.cpp | |
parent | dfb4af1fd34a163495790a7896acafa56b86a8f1 (diff) |
QCalendarWidget: move QCalendarTextNavigator into qcalendarwidget.cpp
This is in preparation of a change putting all these helper classes
into the unnamed namespace.
Change-Id: I553b1e23b6cdbe6daa492c2dc4c26406ac580de3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/widgets/widgets/qcalendarwidget.cpp')
-rw-r--r-- | src/widgets/widgets/qcalendarwidget.cpp | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index 8755f99288..df7097c465 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -60,7 +60,6 @@ #include <qapplication.h> #include <qbasictimer.h> #include <qstylepainter.h> -#include <private/qcalendartextnavigator_p.h> QT_BEGIN_NAMESPACE @@ -671,6 +670,47 @@ void QCalendarDateValidator::handleKeyEvent(QKeyEvent *keyEvent) toPreviousToken(); } +////////////////////////////////// + +class QCalendarTextNavigator: public QObject +{ + Q_OBJECT +public: + QCalendarTextNavigator(QObject *parent = 0) + : QObject(parent), m_dateText(0), m_dateFrame(0), m_dateValidator(0), m_widget(0), m_editDelay(1500), m_date(QDate::currentDate()) { } + + QWidget *widget() const; + void setWidget(QWidget *widget); + + int dateEditAcceptDelay() const; + void setDateEditAcceptDelay(int delay); + + QDate date() const; + void setDate(const QDate &date); + + bool eventFilter(QObject *o, QEvent *e); + void timerEvent(QTimerEvent *e); + +signals: + void dateChanged(const QDate &date); + void editingFinished(); + +private: + void applyDate(); + void updateDateLabel(); + void createDateLabel(); + void removeDateLabel(); + + QLabel *m_dateText; + QFrame *m_dateFrame; + QBasicTimer m_acceptTimer; + QCalendarDateValidator *m_dateValidator; + QWidget *m_widget; + int m_editDelay; + + QDate m_date; +}; + QWidget *QCalendarTextNavigator::widget() const { return m_widget; |