Hi,

For a computer vision class I'm writing a program to capture images from a webcam using opencv and then displaying it in a Qt GUI. The capture all works, and I copy the 3 channel OpenCV image to the 4 byte aligned format necessary for Qt in my capture thread (here's a fast implementation of that: http://www.qtcentre.org/forum/p-qima...ostcount7.html ). Then in my widget's paint event I have this:

Qt Code:
  1. void RenderWidget::paintEvent(QPaintEvent*) {
  2. QPainter painter(this);
  3. if(imageData) {
  4. QImage tImg(imageData, 640, 480, QImage::Format_RGB32);
  5. painter.drawImage(QPoint(0,0), tImg);
  6. }
  7. else {
  8. painter.setBrush(Qt::black);
  9. painter.drawRect(rect());
  10. }
  11. }
To copy to clipboard, switch view to plain text mode 

This works fine and displays correctly, but I really don't like the fact that I'm creating a QImage only to then have it converted to a QPixmap for painting which wastes time (about 5-8% CPU time of a Athlon 64 3200 running at 1GHz)

QPixmap has a loadFromData function but it seems to expect an image encoded in PNG/GIF/JPG and won't take my raw 0xffRRGGBB data.
Is there any way to load a QPixmap from raw data like that or paint that data on screen in a more direct manner (OpenGL is not an option)?