QTfrontend/statsPage.cpp
changeset 1636 e528696f2177
parent 1625 37aae47943ce
child 1637 897b37fc4966
equal deleted inserted replaced
1635:cc5976f292f9 1636:e528696f2177
    17  */
    17  */
    18 
    18 
    19 #include <QLabel>
    19 #include <QLabel>
    20 #include <QGridLayout>
    20 #include <QGridLayout>
    21 #include <QGraphicsScene>
    21 #include <QGraphicsScene>
    22 #include <QGraphicsView>
       
    23 
    22 
    24 #include "statsPage.h"
    23 #include "statsPage.h"
       
    24 
       
    25 FitGraphicsView::FitGraphicsView(QWidget* parent) : QGraphicsView(parent)
       
    26 {
       
    27 
       
    28 }
       
    29 
       
    30 void FitGraphicsView::resizeEvent(QResizeEvent * event)
       
    31 {
       
    32 	fitInView(sceneRect());
       
    33 }
    25 
    34 
    26 PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent)
    35 PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent)
    27 {
    36 {
    28 	QFont * font14 = new QFont("MS Shell Dlg", 14);
    37 	QFont * font14 = new QFont("MS Shell Dlg", 14);
    29 	QGridLayout * pageLayout = new QGridLayout(this);
    38 	QGridLayout * pageLayout = new QGridLayout(this);
    35 
    44 
    36 	labelGameStats = new QLabel(this);
    45 	labelGameStats = new QLabel(this);
    37 	labelGameStats->setTextFormat(Qt::RichText);
    46 	labelGameStats->setTextFormat(Qt::RichText);
    38 	pageLayout->addWidget(labelGameStats, 0, 0, 1, 3);
    47 	pageLayout->addWidget(labelGameStats, 0, 0, 1, 3);
    39 
    48 
    40 	graphic = new QGraphicsView(this);
    49 	graphic = new FitGraphicsView(this);
    41 	graphic->scale(1.0, -1.0);
    50 	graphic->scale(1.0, -1.0);
    42 	pageLayout->addWidget(graphic, 1, 0, 1, 3);
    51 	pageLayout->addWidget(graphic, 1, 0, 1, 3);
    43 }
    52 }
    44 
    53 
    45 void PageGameStats::AddStatText(const QString & msg)
    54 void PageGameStats::AddStatText(const QString & msg)
    74 		scene->addPath(path, QPen(c));
    83 		scene->addPath(path, QPen(c));
    75 		++i;
    84 		++i;
    76 	}
    85 	}
    77 
    86 
    78 	graphic->setScene(scene);
    87 	graphic->setScene(scene);
    79 	graphic->fitInView(graphic->sceneRect());
       
    80 }
    88 }
    81 
    89 
    82 void PageGameStats::GameStats(char type, const QString & info)
    90 void PageGameStats::GameStats(char type, const QString & info)
    83 {
    91 {
    84 	switch(type) {
    92 	switch(type) {