Hi, I am new to Qwt,,
I am facing a problem in which I get crash when I call QwtPlot::replot or QwtPlot::Print from inside a thread. My use case is, I need to send data from a thread, and to speed up things I wanted to print the plot and send the image.
But when I call replot or print,,, I get the following as attached in the image.
I guess it is because we cant paint to QPixmap from thread, and I have seen that QwtPlot uses Qpixmap as cache. But i also tried disabling the caching by -
plot->canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached,fals e); but still getting crash.
From call stack I see that qwt accesses font metric and -
In QWidget::metric() --
HDC gdc = qt_win_display_dc();
In Q_GUI_EXPORT HDC qt_win_display_dc() // get display DC
{
Q_ASSERT(qApp && qApp->thread() == QThread::currentThread());
Thats where it fails.
I searched the forum but cudnt get a solution to my problem. I just need the plot in QImage inside the thread. I need it to send to some other client. I am very much stuck and help will be highly appreciated.
Bookmarks