##// END OF EJS Templates
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.

File last commit:

r203:7350e0387b3f
r203:7350e0387b3f
Show More
main.cpp
42 lines | 1.1 KiB | text/x-c | CppLexer
Jani Honkonen
Added piechart example
r128 #include <QtGui/QApplication>
#include <QMainWindow>
#include <qchartglobal.h>
Michal Klocek
Removes QChartWidget...
r136 #include <qchartview.h>
Jani Honkonen
Added piechart example
r128 #include <qpieseries.h>
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 #include <qpieslice.h>
#include "customslice.h"
Jani Honkonen
Added piechart example
r128
QTCOMMERCIALCHART_USE_NAMESPACE
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 QMainWindow window;
QPieSeries *series = new QPieSeries();
series->add(5, "Slice 1");
series->add(2, "Slice 2");
series->add(3, "Slice 3");
series->add(4, "Slice 4");
series->add(5, "Slice 5");
series->add(6, "Slice 6");
series->add(7, "Slice 7");
series->add(new CustomSlice(8));
series->enableClickExplodes(true);
series->enableHoverHighlight(true);
foreach (QPieSlice*s, series->slices())
qDebug() << s->angle() << s->span() << s->percentage();
QChartView* chartView = new QChartView(&window);
chartView->addSeries(series);
chartView->setChartTitle("simple piechart");
chartView->setChartTheme(QChart::ChartThemeIcy);
window.setCentralWidget(chartView);
window.resize(600, 600);
window.show();
Jani Honkonen
Added piechart example
r128
return a.exec();
}