##// END OF EJS Templates
Added support for data from model to QBarSeries. Various fixes and small modifications to data from model support to other series
Added support for data from model to QBarSeries. Various fixes and small modifications to data from model support to other series

File last commit:

r541:4eee071cd5a1
r630:dd8db9a3a988
Show More
mainwindow.cpp
38 lines | 958 B | text/x-c | CppLexer
#include "mainwindow.h"
#include <qchartglobal.h>
#include <qchartview.h>
#include <qchartaxis.h>
#include <QDebug>
QTCOMMERCIALCHART_USE_NAMESPACE
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
QChartView *chartView = new QChartView(this);
chartView->setChartTitle("Click to remove scatter point");
chartView->setRenderHint(QPainter::Antialiasing);
setCentralWidget(chartView);
m_scatter = new QScatterSeries();
for(qreal x(0.5); x <= 4.0; x += 0.5) {
for(qreal y(0.5); y <= 4.0; y += 0.5) {
*m_scatter << QPointF(x, y);
}
}
chartView->addSeries(m_scatter);
chartView->axisX()->setRange(0,4.5);
chartView->axisY()->setRange(0,4.5);
connect(m_scatter, SIGNAL(clicked(const QPointF&)), this, SLOT(handleClickedPoint(const QPointF&)));
}
MainWindow::~MainWindow()
{
}
void MainWindow::handleClickedPoint(const QPointF& point)
{
m_scatter->remove(point);
}