main.cpp
38 lines
| 794 B
| text/x-c
|
CppLexer
Jani Honkonen
|
r128 | #include <QtGui/QApplication> | ||
#include <QMainWindow> | ||||
#include <qchartglobal.h> | ||||
Michal Klocek
|
r136 | #include <qchartview.h> | ||
Jani Honkonen
|
r128 | #include <qpieseries.h> | ||
Jani Honkonen
|
r203 | #include <qpieslice.h> | ||
Jani Honkonen
|
r128 | |||
QTCOMMERCIALCHART_USE_NAMESPACE | ||||
int main(int argc, char *argv[]) | ||||
{ | ||||
QApplication a(argc, argv); | ||||
Jani Honkonen
|
r203 | QMainWindow window; | ||
Jani Honkonen
|
r341 | QChartView* chartView = new QChartView(&window); | ||
//! [1] | ||||
Jani Honkonen
|
r203 | QPieSeries *series = new QPieSeries(); | ||
Jani Honkonen
|
r341 | series->add(1, "Slice 1"); | ||
Jani Honkonen
|
r203 | series->add(2, "Slice 2"); | ||
series->add(3, "Slice 3"); | ||||
series->add(4, "Slice 4"); | ||||
series->add(5, "Slice 5"); | ||||
Jani Honkonen
|
r293 | chartView->addSeries(series); | ||
Jani Honkonen
|
r341 | //! [1] | ||
Jani Honkonen
|
r203 | |||
Jani Honkonen
|
r345 | //! [2] | ||
Jani Honkonen
|
r386 | series->setHoverHighlighting(); | ||
series->setClickExplodes(); | ||||
Jani Honkonen
|
r345 | //! [2] | ||
Jani Honkonen
|
r203 | window.setCentralWidget(chartView); | ||
window.resize(600, 600); | ||||
window.show(); | ||||
Jani Honkonen
|
r128 | |||
return a.exec(); | ||||
} | ||||