mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Added focus handling to the Date Picker.
Added focus handling for the date picker, this way the user can use the keyboard to change the date. ( still not implemented ) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
70c8bbcc91
commit
a7240cd83f
3 changed files with 31 additions and 10 deletions
|
|
@ -305,6 +305,7 @@ DateWidget::DateWidget(QWidget *parent) : QWidget(parent),
|
|||
{
|
||||
setDate(QDate::currentDate());
|
||||
setMinimumSize(QSize(64,64));
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
calendarWidget->setWindowFlags(Qt::FramelessWindowHint);
|
||||
|
||||
connect(calendarWidget, SIGNAL(activated(QDate)), calendarWidget, SLOT(hide()));
|
||||
|
|
@ -352,6 +353,9 @@ void DateWidget::paintEvent(QPaintEvent *event)
|
|||
painter.setBrush(Qt::black);
|
||||
painter.setFont(font);
|
||||
painter.drawText(QPoint(32 - metrics.width(day)/2, 45), day);
|
||||
|
||||
if(hasFocus())
|
||||
painter.drawLine(0, 63, 63, 63);
|
||||
}
|
||||
|
||||
void DateWidget::mousePressEvent(QMouseEvent *event)
|
||||
|
|
@ -360,3 +364,14 @@ void DateWidget::mousePressEvent(QMouseEvent *event)
|
|||
calendarWidget->show();
|
||||
}
|
||||
|
||||
|
||||
void DateWidget::focusInEvent(QFocusEvent *event)
|
||||
{
|
||||
setFocus();
|
||||
QWidget::focusInEvent(event);
|
||||
}
|
||||
|
||||
void DateWidget::focusOutEvent(QFocusEvent *event)
|
||||
{
|
||||
QWidget::focusOutEvent(event);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue