how could I use the signal and slot mechanism to notify when I am finished painting?
You're probably not going to have an actual paintEvent() in your thread, but instead you will have some other method that creates a new QImage with the current data. For whatever class it is that implements this updating, be sure it is derived from QObject (so it can emit signals), and implement a signal with a signature something like:
signals:
void imageUpdated
( const QImage & image
);
signals:
void imageUpdated( const QImage & image );
To copy to clipboard, switch view to plain text mode
In the GUI thread, add a slot to whatever QWidget class will display the image, and connect that slot to the thread's signal:
public slots:
void onImageUpdated
( const QImage & image
);
public slots:
void onImageUpdated( const QImage & image );
To copy to clipboard, switch view to plain text mode
In that slot, copy the image, then call QWidget::update() to schedule a paintEvent().
I am not familiar enough with the current state of Qwt to know how you would integrate this QImage-based rendering into a QwtPlot. Perhaps you would need to actually paint the entire QwtPlot into the QImage in your thread, or perhaps Qwt has a spectrogram-like plot where a QImage can be substituted for a calculated spectrogram.
Bookmarks