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();
|
for (QList<KV<QString, QString> >::const_iterator i = _list.constBegin();
|
||||||
i != _list.constEnd(); i++) {
|
i != _list.constEnd(); i++) {
|
||||||
width += fm.boundingRect(i->key() + ": ").width();
|
width += fm.horizontalAdvance(i->key() + ": " + i->value());
|
||||||
width += fm.boundingRect(i->value()).width()
|
if (i != _list.constEnd() - 1)
|
||||||
+ ((i == _list.constEnd() - 1) ? 0 : PADDING);
|
width += PADDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
_boundingRect = QRectF(0, 0, width, _list.isEmpty() ? 0 : fm.height());
|
_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();
|
for (QList<KV<QString, QString> >::const_iterator i = _list.constBegin();
|
||||||
i != _list.constEnd(); i++) {
|
i != _list.constEnd(); i++) {
|
||||||
painter->drawText(width, fm.height() - fm.descent(), i->key() + ": ");
|
QString text(i->key() + ": " + i->value());
|
||||||
width += fm.boundingRect(i->key() + ": ").width();
|
painter->drawText(width, fm.height() - fm.descent(), text);
|
||||||
painter->drawText(width, fm.height() - fm.descent(), i->value());
|
width += fm.horizontalAdvance(text);
|
||||||
width += fm.boundingRect(i->value()).width()
|
|
||||||
+ ((i == _list.constEnd() - 1) ? 0 : PADDING);
|
|
||||||
if (i != _list.constEnd() - 1) {
|
if (i != _list.constEnd() - 1) {
|
||||||
|
width += PADDING;
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setPen(Qt::gray);
|
painter->setPen(Qt::gray);
|
||||||
painter->drawLine(width - PADDING/2, fm.descent(),
|
painter->drawLine(width - PADDING/2, fm.descent(),
|
||||||
|
Loading…
Reference in New Issue
Block a user