Skip to content
Snippets Groups Projects
Commit 8ce36e98 authored by Jens Bache-Wiig's avatar Jens Bache-Wiig
Browse files

Fix text eliding and rtl issues with miniprojectselector

* Fixed an issue with text eliding on combo boxes
* Fixed placement of arrow on elided comboboxes

Task-number: QTCREATORBUG-1278
parent ed77a90d
No related branches found
No related tags found
No related merge requests found
...@@ -720,12 +720,12 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt ...@@ -720,12 +720,12 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
QString text = option->fontMetrics.elidedText(cb->currentText, Qt::ElideRight, editRect.width()); QString text = option->fontMetrics.elidedText(cb->currentText, Qt::ElideRight, editRect.width());
if ((option->state & State_Enabled)) { if ((option->state & State_Enabled)) {
painter->setPen(QColor(0, 0, 0, 70)); painter->setPen(QColor(0, 0, 0, 70));
painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, cb->currentText); painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, text);
} else { } else {
painter->setOpacity(0.8); painter->setOpacity(0.8);
} }
painter->setPen(Utils::StyleHelper::panelTextColor()); painter->setPen(Utils::StyleHelper::panelTextColor());
painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, cb->currentText); painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, text);
painter->restore(); painter->restore();
} else { } else {
...@@ -941,8 +941,11 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti ...@@ -941,8 +941,11 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
QRect arrowRect((left + right) / 2 + (reverse ? 6 : -6), rect.center().y() - 3, 9, 9); QRect arrowRect((left + right) / 2 + (reverse ? 6 : -6), rect.center().y() - 3, 9, 9);
if (!alignarrow) { if (!alignarrow) {
int leftOffset = option->fontMetrics.width(cb->currentText) + 12; int labelwidth = option->fontMetrics.width(cb->currentText);
arrowRect.moveLeft(leftOffset); if (reverse)
arrowRect.moveLeft(qMax(rect.width() - labelwidth - menuButtonWidth - 2, 4));
else
arrowRect.moveLeft(qMin(labelwidth + menuButtonWidth - 2, rect.width() - menuButtonWidth - 4));
} }
if (option->state & State_On) if (option->state & State_On)
arrowRect.translate(QProxyStyle::pixelMetric(PM_ButtonShiftHorizontal, option, widget), arrowRect.translate(QProxyStyle::pixelMetric(PM_ButtonShiftHorizontal, option, widget),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment