title: How to display a raw image file in a Qt GUI?
body: <p>I'm new to C++ and Qt but I was wondering if anyone could help me.</p>
  
  <p>I have a raw image file named <code>fb0</code> with the following properties:</p>
  
  <pre><code>Width: 1024
  Height: 768
  Format: rgb565 (QImage::Format_RGB16?)
  </code></pre>
  
  <p>How would I go about loading the data from <code>fb0</code> and then displaying this image in a Qt GUI?</p>
  
  <p><strong>Solution:</strong></p>
  
  <pre><code>   QFile file("C:\\Users\\Username\\Desktop\\RawImage.raw");
     if (!file.open(QFile::ReadOnly))
     {
         qDebug("Could not open file");
     } else {
         qDebug() &lt;&lt; file.fileName() &lt;&lt; " opened";
     }
     QByteArray array =file.readAll();
     unsigned char* Data = (unsigned char*)&amp;array.data()[0];
     QImage myImage(Data,1024,768,QImage::Format_RGB16);
     QLabel myLabel;
     myLabel.setPixmap(QPixmap::fromImage(myImage));
     myLabel.show();
  </code></pre>