QtCharts delayed legend repaint
I'm trying to move the line legend to a new location and then use the grab() routine to save an image to disk. My saved image has the legend in the previous location because of a delay in rendering. Calling processEvents() is not helping me in this case. Any advice?
Re: QtCharts delayed legend repaint
Maybe try using a single-shot QTimer to delay the grab? My understanding (possibly incorrect) is that QTimer will fire only after the event queue is empty. Alternatively, try using QWidget::render() instead of grab(). I think grab() makes a copy of the on-screen pixels, whereas render() actually redraws the widget into the image.
Re: QtCharts delayed legend repaint
Quote:
Originally Posted by
d_stranz
Maybe try using a single-shot QTimer to delay the grab? My understanding (possibly incorrect) is that QTimer will fire only after the event queue is empty. Alternatively, try using
QWidget::render() instead of grab(). I think grab() makes a copy of the on-screen pixels, whereas render() actually redraws the widget into the image.
Unfortunately, the QWidget::render() did not fix the problem. Same issue. The single-shot QTimer I feel would fix my problem in most cases. However, if the user is setting a large dataset I'm not guaranteed the timer has enough milliseconds on it to account for that. Any other ideas? Thanks for the suggestions by the way, I had not tried those.