title: Qt QImage to QPixmap Conversion loses Color Information for UI
body: <p>I am trying to update a QPixmap on a QLabel in my main Qt UI. The following slot is called to do this with the "newImage" variable QImage ( because it's from a different thread ). The QImage is converted to someImage with convertFromImage ( I've also tried ::fromImage ). If I just save the QImage "newImage" to file, I get a green rectangle and red text that I draw with OpenCV earlier on, however, if I save the converted pixmap OR show the converted pixmap I lose the color for the rectangle and text in the image but keep the color for the frame itself. I've posted 2 images below to demonstrate the difference between the QImage I pass this slot and the pixmap that is displayed on the UI in the pixmap. I don't know how to have the pixmap display the rectangle and text with color! What am I doing wrong? Thanks!</p>
  
  <p><img src="https://i.stack.imgur.com/kOJho.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/QH7ch.png" alt="enter image description here"></p>
  
  <pre><code>void MainWindow::updateImage(QImage newImage, double timeElapsed) {
  
      QImage someImage = newImage.convertToFormat(QImage::Format_RGB888);
  
      // Get pixmap from data
      m_NewPixMap.convertFromImage(someImage,Qt::ColorOnly); // Tried various ones of these
  
      // Debug status
  //    qDebug() &lt;&lt; "Pixmap received by MainWindow and elapsed time is: " &lt;&lt; timeElapsed &lt;&lt; " ( Image size is: " &lt;&lt; newImage.byteCount() &lt;&lt; " )";
  //    qDebug() &lt;&lt; "Pixmap is null? " &lt;&lt; m_NewPixMap.isNull();
  
      // Update the label
      float hz = 1000.0f / timeElapsed;
      QString status;
      status.sprintf("FrameRate (Hz) = %.02f (%.0f ms)", hz, timeElapsed);
  
      // Update status label
      m_StatusLabel-&gt;setText(status);
  
      // Update the main view
      m_Label-&gt;setPixmap(m_NewPixMap);
      repaint();
  
      //qDebug() &lt;&lt; "Saving QImage now...";
      QFile file(QString("output_detected_images/detected_image_%1.png").arg(m_Counter));
      file.open(QIODevice::WriteOnly);
      bool savedSuccessfully = newImage.save(&amp;file,"PNG"); // This gives proper color in image
      //bool savedSuccessfully =  m_NewPixMap.save(&amp;file, "PNG"); // THIS GIVES A BLACK IMAGE
      qDebug() &lt;&lt; "Done saving QPixmap... " &lt;&lt; savedSuccessfully;
  
  }
  </code></pre>