diff --git a/src/GUI/infoitem.cpp b/src/GUI/infoitem.cpp index 54294170..2904ee74 100644 --- a/src/GUI/infoitem.cpp +++ b/src/GUI/infoitem.cpp @@ -18,9 +18,9 @@ void InfoItem::updateBoundingRect() for (QList >::const_iterator i = _list.constBegin(); i != _list.constEnd(); i++) { - width += fm.boundingRect(i->key() + ": ").width(); - width += fm.boundingRect(i->value()).width() - + ((i == _list.constEnd() - 1) ? 0 : PADDING); + width += fm.horizontalAdvance(i->key() + ": " + i->value()); + if (i != _list.constEnd() - 1) + width += PADDING; } _boundingRect = QRectF(0, 0, width, _list.isEmpty() ? 0 : fm.height()); @@ -39,12 +39,11 @@ void InfoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, for (QList >::const_iterator i = _list.constBegin(); i != _list.constEnd(); i++) { - painter->drawText(width, fm.height() - fm.descent(), i->key() + ": "); - width += fm.boundingRect(i->key() + ": ").width(); - painter->drawText(width, fm.height() - fm.descent(), i->value()); - width += fm.boundingRect(i->value()).width() - + ((i == _list.constEnd() - 1) ? 0 : PADDING); + QString text(i->key() + ": " + i->value()); + painter->drawText(width, fm.height() - fm.descent(), text); + width += fm.horizontalAdvance(text); if (i != _list.constEnd() - 1) { + width += PADDING; painter->save(); painter->setPen(Qt::gray); painter->drawLine(width - PADDING/2, fm.descent(),