Or you can use QImage::invertPixels