setPixel is slow, use QImage::scanLine() instead. You won't need to protect it with a mutex.