QPainter declared inside a run function creates artifact.
Posted
by yan bellavance
on Stack Overflow
See other posts from Stack Overflow
or by yan bellavance
Published on 2010-04-27T18:22:21Z
Indexed on
2010/04/27
18:23 UTC
Read the original article
Hit count: 355
qt
I am rendering a QPixmap inside of a QThread. the code to paint is inside a function. If I declare the painter inside the drawChart function everything seems ok but if I declare the painter inside the run function the image is wrong in the sense that at the edge of a black and white area, the pixels at the interface are overlapped to give a grey. Does anyone know why this is so? Could it be because of the nature of the run function itself?
//This is ok
void RenderThread::run() { QImage image(resultSize, QImage::Format_RGB32); drawChart(&image); emit renderedImage(image, scaleFactor); }
drawChart(&image){ QPainter painter(image); painter.doStuff()(; ... }
//This gives a image that seems to have artifacts void RenderThread::run() { QImage image(resultSize, QImage::Format_RGB32); QPainter painter(image); drawChart(painter); emit renderedImage(image, scaleFactor); }
drawChart(&painter){ painter.doStuff()(; ... }
© Stack Overflow or respective owner