{
this->setMinimumSize(800, 250);
QTimer::singleShot(5000,
this,
SLOT(updateGraph
()));
}
Dialog::~Dialog()
{
}
{
Q_UNUSED(event);
addGraphs(&painter, 20, 30, 50);
}
void Dialog
::addGraphs(QPainter *qp,
int i,
int j,
int k
) {
Nightcharts chart1;
chart1.setShadows(false);
chart1.setType(Nightcharts::Pie);
chart1.setLegendType(Nightcharts::Vertical);
chart1.setCords(50, 50, 80, 80);
chart1.
addPiece("Item1",
QColor(200,
10,
50), i
);
chart1.addPiece("Item2",Qt::green, j);
chart1.addPiece("Item3",Qt::cyan, k);
chart1.draw(qp);
chart1.drawLegend(qp);
Nightcharts chart2;
chart2.setShadows(false);
chart2.setType(Nightcharts::Pie);
chart2.setLegendType(Nightcharts::Vertical);
chart2.setCords(300, 50, 80, 80);
chart2.addPiece("Item2",Qt::green, j);
chart2.addPiece("Item3",Qt::cyan,k);
chart2.addPiece("Item4",Qt::yellow,i);
chart2.draw(qp);
chart2.drawLegend(qp);
Nightcharts chart3;
chart3.setShadows(false);
chart3.setType(Nightcharts::Pie);
chart3.setLegendType(Nightcharts::Vertical);
chart3.setCords(550, 50, 80, 80);
chart3.
addPiece("Item1",
QColor(200,
10,
50), k
);
chart3.addPiece("Item3",Qt::cyan, i);
chart3.addPiece("Item4",Qt::yellow, j);
chart3.draw(qp);
chart3.drawLegend(qp);
}
void Dialog::updateGraph()
{
qDebug("Updating after 5 seconds");
addGraphs(&painter, 50, 20, 30);
this->update();
}
Dialog::Dialog(QWidget *parent)
: QDialog(parent)
{
this->setMinimumSize(800, 250);
QTimer::singleShot(5000, this, SLOT(updateGraph()));
}
Dialog::~Dialog()
{
}
void Dialog::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
QPainter painter(this);
addGraphs(&painter, 20, 30, 50);
}
void Dialog::addGraphs(QPainter *qp, int i, int j, int k)
{
Nightcharts chart1;
chart1.setShadows(false);
chart1.setType(Nightcharts::Pie);
chart1.setLegendType(Nightcharts::Vertical);
chart1.setCords(50, 50, 80, 80);
chart1.addPiece("Item1",QColor(200,10,50), i);
chart1.addPiece("Item2",Qt::green, j);
chart1.addPiece("Item3",Qt::cyan, k);
chart1.draw(qp);
chart1.drawLegend(qp);
Nightcharts chart2;
chart2.setShadows(false);
chart2.setType(Nightcharts::Pie);
chart2.setLegendType(Nightcharts::Vertical);
chart2.setCords(300, 50, 80, 80);
chart2.addPiece("Item2",Qt::green, j);
chart2.addPiece("Item3",Qt::cyan,k);
chart2.addPiece("Item4",Qt::yellow,i);
chart2.draw(qp);
chart2.drawLegend(qp);
Nightcharts chart3;
chart3.setShadows(false);
chart3.setType(Nightcharts::Pie);
chart3.setLegendType(Nightcharts::Vertical);
chart3.setCords(550, 50, 80, 80);
chart3.addPiece("Item1",QColor(200,10,50), k);
chart3.addPiece("Item3",Qt::cyan, i);
chart3.addPiece("Item4",Qt::yellow, j);
chart3.draw(qp);
chart3.drawLegend(qp);
}
void Dialog::updateGraph()
{
qDebug("Updating after 5 seconds");
QPainter painter(this);
addGraphs(&painter, 50, 20, 30);
this->update();
}
To copy to clipboard, switch view to plain text mode
Bookmarks