Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Is there a widget to draw a function ?
for example i would like to Draw sinus(x) from 0 to 2PI (in QML if possible or QWidgets). Is there something already done ? (i prefer to ask before doing the thing).
onek24 last edited by
i don't know of an existing component for your purposes, but you might check out this "thread":http://qt-project.org/forums/viewthread/8998 .
Already seen it but thanks for the answer.
Torgeir last edited by
For a simple plot of a function a Canvas may suffice:
var numSamples = 300
var amplitude = 100
var ctx = getContext("2d") ctx.beginPath() for (var i = 0; i < numSamples; ++i) ctx.lineTo(i, amplitude + Math.sin(2 * Math.PI * i / numSamples) * amplitude) ctx.stroke() } }
If you need complex scientific plots, have a look at Qwt. Using Qwt in a QQuickPaintedItem looks fairly straight forward. I googled and found an example "here":http://vadim-d.blogspot.no/2013/07/qml-qwt-android.html (the blog post is in russian, but the code is in english).
that what i thought i will have to do it by myself or use qwt.
Thanks for your answers