title: With C++ and Qt how do I display a 16-bit raw file as an image?
body: <p>I am looking to display heightmaps from the video game Battlefield 2 as images in my application.<br>
  I am new to C++ and Qt and it might be straight forward but what I am having trouble with is displaying a grayscale <code>16-bit 1025x1025 2101250</code> bytes image. There is no header to the file.
  I need access to the displayed pixels (does not have to be pixel perfect precision) so I can point to a pixel and get its value.</p>
  
  <p><strong>What I have tried</strong></p>
  
  <p>I have loaded the binary data into a <code>QByteArray</code> from a QFile and I have attempted to use the <code>QImage::fromData</code> function to make the image but I am making a lot of mistakes and spending a lot of time not getting very far. It is my hope that posting here will give me the clue(s) that I need to progress.
  Here is my code:</p>
  
  <pre><code>void LearningBinaryReader::setupReader()
  {
      qDebug("Attempting to open file..");
      QFile file("HeightmapPrimary.raw");
      if (!file.open(QFile::ReadOnly))
      {
          qDebug("Could not open file");
          return;
      } else {
          qDebug() &lt;&lt; file.fileName() &lt;&lt; " opened";
      }
      QByteArray data = file.readAll();
      file.flush();
      file.close();
  
      qDebug() &lt;&lt; data.count() &lt;&lt; "bytes loaded.";
  }
  </code></pre>
  
  <p>From here I am at a loss of what to do. I have read some of the Qt documentation, but I being new I need a guide in the right direction to understand this problem and get the solution.</p>
  
  <p><strong>Please note</strong> I am pretty much a beginner so don't discount easy solutions that I might not have thought of. I would like to do this just using the Qt framework.</p>