Вот как бы вы использовали этот конструктор:
int imageWidth = 800;
int imageHeight = 600;
int bytesPerPixel = 4; // 4 for RGBA, 3 for RGB
int format = QImage::Format_ARGB32; // this is the pixel format - check Qimage::Format enum type for more options
QImage image(yourData, imageWidth, imageHeight, imageWidth * bytesPerPixel, format);
Вы указываете не формат изображения (png, jpeg и т. Д.), А формат пикселя (RGB, RGBA и т. Д.)