vector<int> x, y;
QRect r
= graphiqueNotes
->rect
();
// "graphiquesNotes" is a QGraphicsView on the window
painter.setClipRect(r);
x.push_back(1); // Let's suppose that we have two marks : one 8 and one 15
x.push_back(2);
y.push_back(8);
y.push_back(15);
xMap.setScaleInterval(0, (double)x.size() + 1);
yMap.setScaleInterval(0, 20);
xMap.setPaintInterval(r.left(), r.right());
yMap.setPaintInterval(r.top(), r.bottom());
sym.
setPen(QColor(Qt
::black));
sym.setSize(5);
crv.setSymbol(sym);
crv.
setPen(QColor(Qt
::darkGreen));
crv.setRawData(x.data(), y.data(), x.size());
crv.attach(myPlot);
myPlot->replot();
crv.draw(&painter, xMap, yMap, r);
vector<int> x, y;
QwtPlotCurve crv;
QwtPlot *myPlot = new QwtPlot(QwtText("Graphique de notes"), this);
QRect r = graphiqueNotes->rect(); // "graphiquesNotes" is a QGraphicsView on the window
QPainter painter(this);
painter.setClipRect(r);
x.push_back(1); // Let's suppose that we have two marks : one 8 and one 15
x.push_back(2);
y.push_back(8);
y.push_back(15);
xMap.setScaleInterval(0, (double)x.size() + 1);
yMap.setScaleInterval(0, 20);
xMap.setPaintInterval(r.left(), r.right());
yMap.setPaintInterval(r.top(), r.bottom());
QwtSymbol sym;
sym.setStyle(QwtSymbol::Cross);
sym.setPen(QColor(Qt::black));
sym.setSize(5);
crv.setSymbol(sym);
crv.setPen(QColor(Qt::darkGreen));
crv.setStyle(QwtPlotCurve::Lines);
crv.setRenderHint(QwtPlotItem::RenderAntialiased);
crv.setRawData(x.data(), y.data(), x.size());
crv.attach(myPlot);
myPlot->replot();
crv.draw(&painter, xMap, yMap, r);
To copy to clipboard, switch view to plain text mode
Bookmarks