summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-06-19 15:58:27 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-20 15:41:57 -0700
commitef6c41057471245be863636ae00a841326a44f6c (patch)
tree2964becdaf09337ba504051bdd22ceeccdc83f05 /qt-ui
parenta7240cd83f24c64d4a65d5f2ed22d1f61d810769 (diff)
downloadsubsurface-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.cpp15
-rw-r--r--qt-ui/simplewidgets.h1
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: