From 1ffa2ffcd0668b4bab66d327ca0073b5d9ff24c7 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig <jbache@trolltech.com> Date: Fri, 12 Mar 2010 13:16:18 +0100 Subject: [PATCH] Fix etched combo box text in panels Some styles use etched text and drawtextitem does not pass the widget pointer, hence our panelwidget tests are broken. I simply replaced this with drawText for now. --- src/plugins/coreplugin/manhattanstyle.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 07f20dff19e..924b290c763 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -669,20 +669,16 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt editRect.adjust(0, 0, -13, 0); } - customPal.setBrush(QPalette::All, QPalette::ButtonText, QColor(0, 0, 0, 70)); - QString text = option->fontMetrics.elidedText(cb->currentText, Qt::ElideRight, editRect.width()); - if ((option->state & State_Enabled)) - drawItemText(painter, editRect.translated(0, 1), - visualAlignment(option->direction, Qt::AlignLeft | Qt::AlignVCenter), - customPal, cb->state & State_Enabled, text, QPalette::ButtonText); - else + if ((option->state & State_Enabled)) { + painter->setPen(QColor(0, 0, 0, 70)); + painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, cb->currentText); + } else { painter->setOpacity(0.8); + } + painter->setPen(Utils::StyleHelper::panelTextColor()); + painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, cb->currentText); - customPal.setBrush(QPalette::All, QPalette::ButtonText, Utils::StyleHelper::panelTextColor()); - drawItemText(painter, editRect, - visualAlignment(option->direction, Qt::AlignLeft | Qt::AlignVCenter), - customPal, cb->state & State_Enabled, text, QPalette::ButtonText); painter->restore(); } else { QProxyStyle::drawControl(element, option, painter, widget); -- GitLab