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>
This commit is contained in:
Tomaz Canabrava 2014-06-19 15:58:27 -03:00 committed by Dirk Hohndel
parent a7240cd83f
commit ef6c410574
2 changed files with 15 additions and 1 deletions

View file

@ -374,4 +374,17 @@ void DateWidget::focusInEvent(QFocusEvent *event)
void DateWidget::focusOutEvent(QFocusEvent *event) void DateWidget::focusOutEvent(QFocusEvent *event)
{ {
QWidget::focusOutEvent(event); QWidget::focusOutEvent(event);
} }
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);
}
}

View file

@ -102,6 +102,7 @@ protected:
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event);
void focusInEvent(QFocusEvent *); void focusInEvent(QFocusEvent *);
void focusOutEvent(QFocusEvent *); void focusOutEvent(QFocusEvent *);
void keyPressEvent(QKeyEvent *);
signals: signals:
void dateChanged(const QDate& date); void dateChanged(const QDate& date);
private: private: