Listen to EnabledChange to gray out the DatePicker

This small patch listens to EnabledChange to gray out the
date picker when the widget is in disabled mode, and to
paint the widget colored when it's on enabled state.

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 19:57:53 -03:00 committed by Dirk Hohndel
parent be462ae1a6
commit 6ee2758e06
2 changed files with 8 additions and 0 deletions

View file

@ -326,6 +326,13 @@ QDate DateWidget::date() const
return mDate;
}
void DateWidget::changeEvent(QEvent *event)
{
if(event->type() == QEvent::EnabledChange){
update();
}
}
void DateWidget::paintEvent(QPaintEvent *event)
{
static QPixmap pix = QPixmap(":/calendar").scaled(64,64);

View file

@ -103,6 +103,7 @@ protected:
void focusInEvent(QFocusEvent *);
void focusOutEvent(QFocusEvent *);
void keyPressEvent(QKeyEvent *);
void changeEvent(QEvent *);
signals:
void dateChanged(const QDate& date);
private: