QTfrontend/ui/page/pagegamestats.cpp
branchqt5transition
changeset 13158 99dd144f0a54
parent 12474 42da9d8d82ab
child 13186 07c93d864bc2
equal deleted inserted replaced
12897:fc47fc4af6bd 13158:99dd144f0a54
    76     labelGraphTitle->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    76     labelGraphTitle->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    77     gbl->addWidget(labelGraphTitle);
    77     gbl->addWidget(labelGraphTitle);
    78     gbl->addWidget(graphic);
    78     gbl->addWidget(graphic);
    79     graphic->scale(1.0, -1.0);
    79     graphic->scale(1.0, -1.0);
    80     graphic->setBackgroundBrush(QBrush(Qt::black));
    80     graphic->setBackgroundBrush(QBrush(Qt::black));
       
    81     graphic->setRenderHint(QPainter::Antialiasing, true);
    81 
    82 
    82     labelGameWin = new QLabel(this);
    83     labelGameWin = new QLabel(this);
    83     labelGameWin->setTextFormat(Qt::RichText);
    84     labelGameWin->setTextFormat(Qt::RichText);
    84     pageLayout->addWidget(labelGameWin, 0, 0, 1, 2);
    85     pageLayout->addWidget(labelGameWin, 0, 0, 1, 2);
    85 
    86 
   170     // if not health data sent
   171     // if not health data sent
   171     if(healthPoints.size() == 0) {
   172     if(healthPoints.size() == 0) {
   172         labelGraphTitle->hide();
   173         labelGraphTitle->hide();
   173         graphic->hide();
   174         graphic->hide();
   174     } else {
   175     } else {
   175         QGraphicsScene * scene = new QGraphicsScene();
   176         graphic->setScene(Q_NULLPTR);
       
   177         m_scene.reset(new QGraphicsScene(this));
   176 
   178 
   177         QMap<quint32, QVector<quint32> >::const_iterator i = healthPoints.constBegin();
   179         QMap<quint32, QVector<quint32> >::const_iterator i = healthPoints.constBegin();
   178         while (i != healthPoints.constEnd())
   180         while (i != healthPoints.constEnd())
   179         {
   181         {
   180             quint32 c = i.key();
   182             quint32 c = i.key();
   186                 path.moveTo(0, hps[0]);
   188                 path.moveTo(0, hps[0]);
   187 
   189 
   188             for(int t = 1; t < hps.size(); ++t)
   190             for(int t = 1; t < hps.size(); ++t)
   189                 path.lineTo(t, hps[t]);
   191                 path.lineTo(t, hps[t]);
   190 
   192 
   191             scene->addPath(path, QPen(c));
   193             QPen pen(c);
       
   194             pen.setWidth(2);
       
   195             pen.setCosmetic(true);
       
   196 
       
   197             m_scene->addPath(path, pen);
   192             ++i;
   198             ++i;
   193         }
   199         }
   194 
   200 
   195         graphic->setScene(scene);
   201         graphic->setScene(m_scene.data());
   196         graphic->fitInView(graphic->sceneRect());
   202         graphic->fitInView(graphic->sceneRect());
   197     }
   203     }
   198 }
   204 }
   199 
   205 
   200 void PageGameStats::GameStats(char type, const QString & info)
   206 void PageGameStats::GameStats(char type, const QString & info)