##// END OF EJS Templates
Added size customization to QScatterSeries
Added size customization to QScatterSeries

File last commit:

r397:e3d058df67ba
r397:e3d058df67ba
Show More
main.cpp
51 lines | 1.4 KiB | text/x-c | CppLexer
Tero Ahola
Added minimalistic scatter example
r123 #include <QtGui/QApplication>
#include <QMainWindow>
#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);
Tero Ahola
Scatter series documentation; now uses snippets
r300 //! [1]
// Create chart view
Tero Ahola
QDoc to use style sheets...
r260 QChartView *chartView = new QChartView();
Tero Ahola
Added size customization to QScatterSeries
r397 chartView->setRenderHint(QPainter::Antialiasing);
chartView->setChartTheme(QChart::ChartThemeScientific);
// Add scatter series with linear test data with random "noise"
Tero Ahola
added stream operator to scatter series
r180 QScatterSeries *scatter = new QScatterSeries();
Tero Ahola
Added size customization to QScatterSeries
r397 for (qreal i(0.0); i < 20; i += 0.25) {
qreal x = i + (qreal)(rand() % 100) / 100.0;
qreal y = i + (qreal)(rand() % 100) / 100.0;
(*scatter) << QPointF(x, y);
}
Tero Ahola
QDoc to use style sheets...
r260 // Chart takes ownership
chartView->addSeries(scatter);
Tero Ahola
Refactored chartwidgettest test data impl
r278 //! [1]
Tero Ahola
Added minimalistic scatter example
r123
Tero Ahola
Scatter series documentation; now uses snippets
r300 // And more
Tero Ahola
Added size customization to QScatterSeries
r397 //! [2]
//*scatter << QPointF(2.0, 5.5) << QPointF(2.2, 5.4);
//! [2]
Tero Ahola
Scatter series documentation; now uses snippets
r300
Tero Ahola
Added size customization to QScatterSeries
r397 //! [3]
QBrush brush(QColor(255, 0, 0, 80), Qt::SolidPattern);
Tero Ahola
Fixing review findings in QScatterSeries
r358 scatter->setBrush(brush);
Tero Ahola
Added size customization to QScatterSeries
r397 QPen pen(QColor(0, 255, 0, 60), 3);
Tero Ahola
Fixing review findings in QScatterSeries
r358 scatter->setPen(pen);
scatter->setShape(QScatterSeries::MarkerShapeRectangle);
Tero Ahola
Added size customization to QScatterSeries
r397 scatter->setSize(15.0);
//! [3]
Tero Ahola
Added minimalistic scatter example
r123
// Use the chart widget as the central widget
QMainWindow w;
Tero Ahola
Clicked, remove and clear to QScatterSeries
r394 w.resize(400, 300);
Tero Ahola
QDoc to use style sheets...
r260 w.setCentralWidget(chartView);
Tero Ahola
Clicked, remove and clear to QScatterSeries
r394 w.setWindowFlags(Qt::FramelessWindowHint);
Tero Ahola
Added minimalistic scatter example
r123 w.show();
return a.exec();
}