mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Fixed broken graph info layout
This commit is contained in:
parent
0ec265e4ea
commit
f7b44b64b0
@ -18,9 +18,9 @@ void InfoItem::updateBoundingRect()
|
||||
|
||||
for (QList<KV<QString, QString> >::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<KV<QString, QString> >::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(),
|
||||
|
Loading…
Reference in New Issue
Block a user