equal
deleted
inserted
replaced
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) { |