Better focus painting for Date Widget

This uses the system focus painging.

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 18:11:44 -03:00 committed by Dirk Hohndel
parent ef6c410574
commit f3f03e2ee8

View file

@ -354,8 +354,12 @@ void DateWidget::paintEvent(QPaintEvent *event)
painter.setFont(font);
painter.drawText(QPoint(32 - metrics.width(day)/2, 45), day);
if(hasFocus())
painter.drawLine(0, 63, 63, 63);
if (hasFocus()) {
QStyleOptionFocusRect option;
option.initFrom(this);
option.backgroundColor = palette().color(QPalette::Background);
style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter, this);
}
}
void DateWidget::mousePressEvent(QMouseEvent *event)