##// END OF EJS Templates
Modifying QScatterSeries API
Modifying QScatterSeries API

File last commit:

r179:0dff3ce36275
r179:0dff3ce36275
Show More
main.cpp
32 lines | 880 B | text/x-c | CppLexer
Tero Ahola
Added minimalistic scatter example
r123 #include <QtGui/QApplication>
#include <QMainWindow>
#include <cmath>
#include <qchartglobal.h>
Michal Klocek
Removes QChartWidget...
r136 #include <qchartview.h>
Tero Ahola
Added minimalistic scatter example
r123 #include <qscatterseries.h>
QTCOMMERCIALCHART_USE_NAMESPACE
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// Create widget and scatter series
Michal Klocek
Removes QChartWidget...
r136 QChartView *chartWidget = new QChartView();
Tero Ahola
Added minimalistic scatter example
r123 QScatterSeries *scatter =
Jani Honkonen
Fixed a double delete chrash with scatter example
r129 qobject_cast<QScatterSeries *>(chartWidget->createSeries(QChartSeries::SeriesTypeScatter));
Tero Ahola
Added minimalistic scatter example
r123 Q_ASSERT(scatter);
// Add test data to the series
Tero Ahola
Modifying QScatterSeries API
r179 for (qreal i(0.0); i < 20; i += 0.5)
scatter->addData(QPointF(i + ((qreal)(rand() % 100)) / 100,
i + ((qreal)(rand() % 100)) / 100 ));
Tero Ahola
Added minimalistic scatter example
r123
// Use the chart widget as the central widget
QMainWindow w;
w.resize(640, 480);
Jani Honkonen
Fixed a double delete chrash with scatter example
r129 w.setCentralWidget(chartWidget);
Tero Ahola
Added minimalistic scatter example
r123 w.show();
return a.exec();
}