Syntactically, your code looks correct.
By reading the class signature, you can call setPixel as follows:
img->setPixel(i, u, QRbg(
Where ## FFRRGGBB is a color quadruplet, unless, of course, you need monochrome 8-bit support.
In addition, declaring a bare pointer is dangerous. The following code is equivalent:
QImage image(640, 480, QImage::Format_something);
QPixmap::fromImage(image);
And it will be freed after the function is completed.
Qt Examples are a great place to look for functionality. Also, study class documentation because they are littered with examples.
source
share