Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QML type to draw with QPainter
alan73 last edited by
In QML documentation I found an example of custom type (defined from C++) to draw on it with QPainter:
class PieChart : public QQuickPaintedItem
void paint(QPainter *painter);
@void PieChart::paint(QPainter painter)
QPen pen(m_color, 2);
painter->drawPie(boundingRect().adjusted(1, 1, -1, -1), 9016, 290*16);
How can I derive a type to draw (e.g. a line) on it asynchronously with QPainter? Thanks!
Jens last edited by
It is not really clear what you mean by asynchronously here. QQuickPainted item is already implicitly painted asynchronously relative to the scenegraph rendering depending on which platform it is running on. Most likely it is exactly what you should be using to draw a line using QPainter. What makes you think it is unsuitable?
aabc last edited by
You can use the QPainter or to use openGL API for paint