summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-06-19 19:57:53 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-20 15:43:13 -0700
commit6ee2758e06a4e06b43dfcf4596c1f86faaa0075e (patch)
tree9cf05e96f8c18ce09aaa209a589035e230886abd /qt-ui
parentbe462ae1a61312fd6b625e00e35c1622bc006f41 (diff)
downloadsubsurface-6ee2758e06a4e06b43dfcf4596c1f86faaa0075e.tar.gz
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>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/simplewidgets.cpp7
-rw-r--r--qt-ui/simplewidgets.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index 5fb9308fd..89b074ca5 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -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);
diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h
index b8cb8aed4..f57046ea3 100644
--- a/qt-ui/simplewidgets.h
+++ b/qt-ui/simplewidgets.h
@@ -103,6 +103,7 @@ protected:
void focusInEvent(QFocusEvent *);
void focusOutEvent(QFocusEvent *);
void keyPressEvent(QKeyEvent *);
+ void changeEvent(QEvent *);
signals:
void dateChanged(const QDate& date);
private: