diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-06-19 15:58:27 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-20 15:41:57 -0700 |
commit | ef6c41057471245be863636ae00a841326a44f6c (patch) | |
tree | 2964becdaf09337ba504051bdd22ceeccdc83f05 /qt-ui | |
parent | a7240cd83f24c64d4a65d5f2ed22d1f61d810769 (diff) | |
download | subsurface-ef6c41057471245be863636ae00a841326a44f6c.tar.gz |
Added keyboard navigation to the calendar date picker.
Wee.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/simplewidgets.cpp | 15 | ||||
-rw-r--r-- | qt-ui/simplewidgets.h | 1 |
2 files changed, 15 insertions, 1 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index fe9b8f592..eff3f668b 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -374,4 +374,17 @@ void DateWidget::focusInEvent(QFocusEvent *event) void DateWidget::focusOutEvent(QFocusEvent *event) { QWidget::focusOutEvent(event); -}
\ No newline at end of file +} + +void DateWidget::keyPressEvent(QKeyEvent *event) +{ + if ( event->key() == Qt::Key_Return || + event->key() == Qt::Key_Enter || + event->key() == Qt::Key_Space){ + calendarWidget->move(mapToGlobal(QPoint(0,64))); + calendarWidget->show(); + event->setAccepted(true); + }else{ + QWidget::keyPressEvent(event); + } +} diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h index 445dfebd4..6587c2739 100644 --- a/qt-ui/simplewidgets.h +++ b/qt-ui/simplewidgets.h @@ -102,6 +102,7 @@ protected: void mousePressEvent(QMouseEvent *event); void focusInEvent(QFocusEvent *); void focusOutEvent(QFocusEvent *); + void keyPressEvent(QKeyEvent *); signals: void dateChanged(const QDate& date); private: |