# HG changeset patch # User unc0rr # Date 1520720182 -3600 # Node ID 99dd144f0a5435f09446df08a0534db85fdee53e # Parent fc47fc4af6bd6f399035923453cd85c8f50146f7 - Fix insane width of lines in health graphic - Fix scene leak diff -r fc47fc4af6bd -r 99dd144f0a54 QTfrontend/ui/page/pagegamestats.cpp --- a/QTfrontend/ui/page/pagegamestats.cpp Wed Jan 24 22:20:10 2018 +0100 +++ b/QTfrontend/ui/page/pagegamestats.cpp Sat Mar 10 23:16:22 2018 +0100 @@ -78,6 +78,7 @@ gbl->addWidget(graphic); graphic->scale(1.0, -1.0); graphic->setBackgroundBrush(QBrush(Qt::black)); + graphic->setRenderHint(QPainter::Antialiasing, true); labelGameWin = new QLabel(this); labelGameWin->setTextFormat(Qt::RichText); @@ -172,7 +173,8 @@ labelGraphTitle->hide(); graphic->hide(); } else { - QGraphicsScene * scene = new QGraphicsScene(); + graphic->setScene(Q_NULLPTR); + m_scene.reset(new QGraphicsScene(this)); QMap >::const_iterator i = healthPoints.constBegin(); while (i != healthPoints.constEnd()) @@ -188,11 +190,15 @@ for(int t = 1; t < hps.size(); ++t) path.lineTo(t, hps[t]); - scene->addPath(path, QPen(c)); + QPen pen(c); + pen.setWidth(2); + pen.setCosmetic(true); + + m_scene->addPath(path, pen); ++i; } - graphic->setScene(scene); + graphic->setScene(m_scene.data()); graphic->fitInView(graphic->sceneRect()); } } diff -r fc47fc4af6bd -r 99dd144f0a54 QTfrontend/ui/page/pagegamestats.h --- a/QTfrontend/ui/page/pagegamestats.h Wed Jan 24 22:20:10 2018 +0100 +++ b/QTfrontend/ui/page/pagegamestats.h Sat Mar 10 23:16:22 2018 +0100 @@ -70,6 +70,7 @@ unsigned int playerPosition; quint32 lastColor; bool defaultGraphTitle; + QScopedPointer m_scene; protected: QLayout * bodyLayoutDefinition();