Fix sub-text rect

This commit is contained in:
craig.p.drummond
2014-07-16 19:02:35 +00:00
parent 55bf1f497b
commit f112cedb9e

View File

@@ -297,7 +297,7 @@ public:
painter->setFont(textFont);
painter->drawText(textRect, text, textOpt);
} else {
QFont childFont(Utils::smallFont(QApplication::font()));
QFont childFont(Utils::smallFont(textFont));
QFontMetrics childMetrics(childFont);
QRect childRect;
@@ -305,7 +305,7 @@ public:
int totalHeight=textHeight+childHeight;
textRect=QRect(r.x(), r.y()+((r.height()-totalHeight)/2), r.width(), textHeight);
childRect=QRect(r.x(), r.y()+textHeight+((r.height()-totalHeight)/2), r.width(),
(iconMode ? textHeight-(2*constBorder) : textHeight));
(iconMode ? childHeight-(2*constBorder) : childHeight));
text = textMetrics.elidedText(text, Qt::ElideRight, textRect.width(), QPalette::WindowText);
painter->setPen(color);