diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-07-08 11:13:06 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-07-08 07:50:43 -0700 |
commit | 7bc11f30443429c8ce8b7a644344fe5c966a50a6 (patch) | |
tree | 169f69c1ccf03feef3f1f659b83578eb5d588fd3 /qt-ui/modeldelegates.cpp | |
parent | 2f9e859615b462a195ccbbe67c67f6ae05367fe6 (diff) | |
download | subsurface-7bc11f30443429c8ce8b7a644344fe5c966a50a6.tar.gz |
Correctly paint the states
The state handling is a pain to do manually, but I can't really
use the style painter because if I do that it would paint the
string of the model (and that's something I don't wanna do)
so I clear the text, draw the control, then I paint the stuff
that I really need.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/modeldelegates.cpp')
-rw-r--r-- | qt-ui/modeldelegates.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp index 423eea3e3..2c03a80f5 100644 --- a/qt-ui/modeldelegates.cpp +++ b/qt-ui/modeldelegates.cpp @@ -520,12 +520,12 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem fontBigger.setPointSize(fontBigger.pointSize() + 1); fontBigger.setBold(true); + initStyleOption(&opt, index); + opt.text = QString(); + qApp->style()->drawControl(QStyle::CE_ItemViewItem, &opt, painter, NULL); + painter->save(); painter->setRenderHint(QPainter::Antialiasing); - if( ( option.state & QStyle::State_Selected ) || ( option.state & QStyle::State_MouseOver ) ) - bg = option.palette.highlight(); - else - bg = option.palette.window(); painter->setPen(QPen(Qt::NoPen)); painter->setBrush(bg); painter->drawRect(option.rect); |