title: QImage: convert from grayscale to RGB with a color table
body: <p>With Qt, I am trying to convert a <code>Format_Indexed8</code> image to <code>Format_RGB30</code> by using a custom conversion rule defined by a color table. I thought this would be simple, since <code>QImage::convertToFormat</code> can take a color table as an argument, but I can't make it work.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>QImage image = QImage(data, width, height, QImage::Format_Indexed8);
  QVector&lt;QRgb&gt; colorTable(256);
  for (int i = 0; i &lt; 255; i++)
      colorTable[i] = qRgb(255 - i, i, i);
  image = image.convertToFormat(QImage::Format_RGB30, colorTable);
  </code></pre>
  
  <p>This code just gives me an image that is in RGB format, but that looks identical to the eye to the grayscale image.</p>