I am using qwt library to draw graphs and then I need to generate images of these graphs, I want to put this part of the work into multithreading so that I can generate multiple images at the same time, then I refer to the official example given below:
QwtPlotRenderer renderer; // the renderer
QRect imageRect( 0.0, 0.0, imageWidth, imageHeight ); // target size in pixels
QImage image( imageRect.size(), QImage::Format_ARGB32 );
image.fill( Qt::white ); // fill with uniform background color, usually white
QPainter painter( &image );
renderer.render( plot, &painter, imageRect );
painter.end();
But now I have a problem:
renderer.render( plot, &painter, imageRect );
The first parameter “plot” called by this method is a QwtPlot object, and QwtPlot is based on QFrame, which means it is a subclass of QWidget.
Because qt seems to be unable to create and use qwidget objects in child threads, I seem to be unable to generate images through multi-threading.
I want to know if there is any way that I can generate pictures of qwt curves through multi-threading.