Your image header contains zeroes while it should contain a proper GIF header that informs about things as the dimensions of the image, depth, then the color map, etc.
To me it seems you are only passing (partial) pixel data and this is not enough. Either create a proper gif header and include it in your buffer or create the QImage object manually and use QImage::bits() to fill it with data in a format compliant with the pixel format (e.g. premultiplied RGBA) of the image you passed when constructing your QImage object.