Q: Loading an image onto a graphics view from a byte array I have some problem with loading image data from raw bmp data loaded previously from a big game file.
I'm sure the data is OK, as the else branch is not reached, but the image is not shown.
Maybe I'm not using loadFromData in a correct way?
Anyone met this problem before?
QByteArray buff((this->current_object->image_buffer));
QPixmap pixmap;
if(pixmap.loadFromData(buff)){
    QGraphicsPixmapItem *item = new QGraphicsPixmapItem(pixmap);
    this->scene->addItem(item);
    this->ui->graphicsView->update();
}else{
    QMessageBox::information(0, "Error.", "Could not convert BMP image.");

    //TEST IF BITMAP IS CORRECT
    FILE *pFile = fopen("/home/konstanty/img.bmp", "wb");
    for(int j=0;j<this->current_object->bitmap_size;j++){
         fwrite (&this->current_object->image_buffer[j], 1 , 1 , pFile);
    }
    fclose(pFile);

    QPixmap imgg("/home/konstanty/img.bmp");
    qDebug() << imgg.isNull(); // output - false


A: The error was in QByteArray constructor, i should ahve used this one.
