summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2010-05-04 14:27:57 (GMT)
committerJens Bache-Wiig <jbache@trolltech.com>2010-05-04 14:27:57 (GMT)
commit08d1eb4f79b9d633b97987cc55f618e6dd05e291 (patch)
tree6c66394e5c8d7fa703ce8bdec89690b9ffefa679 /src
parent3ff7825c6427d9b87f6eecf56e9b5e89e62f9056 (diff)
downloadQt-08d1eb4f79b9d633b97987cc55f618e6dd05e291.zip
Qt-08d1eb4f79b9d633b97987cc55f618e6dd05e291.tar.gz
Qt-08d1eb4f79b9d633b97987cc55f618e6dd05e291.tar.bz2
Fix combobox backgroundrole not respected in some styles
The issue was a regression in 4.5 since we introduced styling. We now set the background role as the menuoption palette when available. Reviewed-by: ogoffart Task-number: QTBUG-10403
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/qcombobox.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 12b1c4a..664bb46 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -143,7 +143,10 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt
menuOption.icon = qvariant_cast<QPixmap>(variant);
break;
}
-
+ if (qVariantCanConvert<QBrush>(index.data(Qt::BackgroundRole))) {
+ menuOption.palette.setBrush(QPalette::All, QPalette::Background,
+ qvariant_cast<QBrush>(index.data(Qt::BackgroundRole)));
+ }
menuOption.text = index.model()->data(index, Qt::DisplayRole).toString()
.replace(QLatin1Char('&'), QLatin1String("&&"));
menuOption.tabWidth = 0;