# HG changeset patch # User unc0rr # Date 1520978269 -3600 # Node ID 07c93d864bc2cea5e22a3d1756da0af35ad5816f # Parent d2f8dafdb0809457ca80217297954692272622de Workaround for the weird new qgraphicsview/qgraphicsscene fitInView behavior diff -r d2f8dafdb080 -r 07c93d864bc2 QTfrontend/ui/page/pagegamestats.cpp --- a/QTfrontend/ui/page/pagegamestats.cpp Tue Mar 13 18:25:37 2018 +0100 +++ b/QTfrontend/ui/page/pagegamestats.cpp Tue Mar 13 22:57:49 2018 +0100 @@ -176,19 +176,32 @@ graphic->setScene(Q_NULLPTR); m_scene.reset(new QGraphicsScene(this)); + quint32 maxValue = 0; + int maxSize = 0; + for(QMap >::const_iterator i = healthPoints.constBegin(); i != healthPoints.constEnd(); ++i) + { + maxSize = qMax(maxSize, i.value().size()); + + foreach (quint32 v, i.value()) + maxValue = qMax(maxValue, v); + } + + if(maxSize < 2) + return; + QMap >::const_iterator i = healthPoints.constBegin(); while (i != healthPoints.constEnd()) { quint32 c = i.key(); //QColor clanColor = QColor(qRgb((c >> 16) & 255, (c >> 8) & 255, c & 255)); - QVector hps = i.value(); + const QVector& hps = i.value(); QPainterPath path; if (hps.size()) path.moveTo(0, hps[0]); for(int t = 1; t < hps.size(); ++t) - path.lineTo(t, hps[t]); + path.lineTo(t * maxValue / (maxSize - 1), hps[t]); QPen pen(c); pen.setWidth(2);