agarny
13th July 2015, 17:36
Hi,
I have been using QwtPlotDirectPainter for some time with Qt 4.7+ and then Qt 5.x, and it has been working perfectly fine. Now, with the recent release of Qt 5.5, I thought I would update my software to use that newer version of Qt.
It's all working fine on Windows and Linux, but on OS X, I am having problems. Indeed, whenever I call QwtPlotDirectPainter::drawSeries(), there is a high risk of the plotting area becoming completely black. After some digging around, I noticed a thread that led me to call QwtPlotDirectPainter::setAttribute() to set QwtPlotDirectPainter::FullRepaint to true for my direct painter.
Now, I thought I had a winner since it is working fine on OS X 10.10, but it doesn't on (Mac) OS X 10.7, 10.8 and 10.9. In fact, it's even worse than that since it crashes my application. Indeed, after calling QwtPlotDirectPainter::drawSeries(), my application crashes and I get the following messages:
QPainter::begin: A paint device can only be painted by one painter at a time.
QPainter::translate: Painter not active
QPainter::begin: A paint device can only be painted by one painter at a time.
QPainter::save: Painter not active
QPainter::setClipRect: Painter not active
QPainter::save: Painter not active
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setPen: Painter not active
QPainter::setPen: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::save: Painter not active
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::restore: Unbalanced save/restore
QPainter::restore: Unbalanced save/restore
I tried to figure out where the crash occurs and it would seem that it occurs upon calling plotCanvas->repaint() in QwtPlotDirectPainter::drawSeries(), i.e. here (http://sourceforge.net/p/qwt/code/HEAD/tree/branches/qwt-6.1/src/qwt_plot_directpainter.cpp#l193).
So... any idea why my application crashes on (Mac) OS X 10.7, 10.8 and 10.9, but not on 10.10 (and not on Windows or Linux either)? Otherwise, and interestingly enough, my original issue with the plotting area becoming black only occurs on (Mac) OS X. So, maybe it has something to do with Qt 5.5 (since it didn't use to happen with Qt 5.4.2)?
I have been using QwtPlotDirectPainter for some time with Qt 4.7+ and then Qt 5.x, and it has been working perfectly fine. Now, with the recent release of Qt 5.5, I thought I would update my software to use that newer version of Qt.
It's all working fine on Windows and Linux, but on OS X, I am having problems. Indeed, whenever I call QwtPlotDirectPainter::drawSeries(), there is a high risk of the plotting area becoming completely black. After some digging around, I noticed a thread that led me to call QwtPlotDirectPainter::setAttribute() to set QwtPlotDirectPainter::FullRepaint to true for my direct painter.
Now, I thought I had a winner since it is working fine on OS X 10.10, but it doesn't on (Mac) OS X 10.7, 10.8 and 10.9. In fact, it's even worse than that since it crashes my application. Indeed, after calling QwtPlotDirectPainter::drawSeries(), my application crashes and I get the following messages:
QPainter::begin: A paint device can only be painted by one painter at a time.
QPainter::translate: Painter not active
QPainter::begin: A paint device can only be painted by one painter at a time.
QPainter::save: Painter not active
QPainter::setClipRect: Painter not active
QPainter::save: Painter not active
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setPen: Painter not active
QPainter::setPen: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::save: Painter not active
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::restore: Unbalanced save/restore
QPainter::restore: Unbalanced save/restore
I tried to figure out where the crash occurs and it would seem that it occurs upon calling plotCanvas->repaint() in QwtPlotDirectPainter::drawSeries(), i.e. here (http://sourceforge.net/p/qwt/code/HEAD/tree/branches/qwt-6.1/src/qwt_plot_directpainter.cpp#l193).
So... any idea why my application crashes on (Mac) OS X 10.7, 10.8 and 10.9, but not on 10.10 (and not on Windows or Linux either)? Otherwise, and interestingly enough, my original issue with the plotting area becoming black only occurs on (Mac) OS X. So, maybe it has something to do with Qt 5.5 (since it didn't use to happen with Qt 5.4.2)?