blob: e88d7bb247487126e2f3adfeaea408b79b0249a8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#include "graphical_stats.h"
#include "ui_graphical_stats.h"
graphical_stats::graphical_stats(QWidget *parent) :
QWidget(parent),
ui(new Ui::graphical_stats)
{
ui->setupUi(this);
connect(this, SIGNAL(window_loaded()), this, SLOT(window_open()), Qt::ConnectionType(Qt::QueuedConnection | Qt::UniqueConnection));
}
graphical_stats::~graphical_stats()
{
delete ui;
}
void graphical_stats::weapon_use_graph()
{
QPieSeries *series = new QPieSeries();
for (int x = 0; x < 5; x ++)
{
series->append(QString::number(x), 1000);
QPieSlice *slice = series->slices().at(x);
slice->setExploded();
slice->setLabelVisible();
slice->setPen(QPen(Qt::darkGreen, 2));
slice->setBrush(Qt::green);
}
QChart *chart = new QChart();
chart->addSeries(series);
chart->setTitle("Simple chart");
chart->legend()->hide();
QGraphicsScene *scene = new QGraphicsScene;
scene->addItem(chart);
scene->addText("test");
ui->graphicsView->setScene(scene);
}
void graphical_stats::window_open()
{
/*
* our graphicals stats are ready to be done
* setup our first graph
*/
weapon_use_graph();
}
void graphical_stats::showEvent(QShowEvent *ev)
{
emit window_loaded();
}
|