Quote Originally Posted by superutsav
I should also mention what i'm using right now, which i'm sure is really horrible, inefficient code, and which keeps the processor busy in a loop, hence making it impossible for me to close the app without killing the process:
You have to kill the process because of the "while(1) {}" infinite loop. You have to give Qt a chance to handle events. So for testing I would add a qapp->processEvents() call to the loop.


Quote Originally Posted by superutsav
Qt Code:
  1. QPixmap myPixmap;
  2. QImage image;
  3. QLabel myLabel;
  4. QWidget window;
  5. QHBoxLayout layout;
  6. layout.addWidget(myLabel);
  7. window.setLayout(&layout);
  8.  
  9. while(1)
  10. {
  11. image = QImage::QImage((uchar*)deviceAccessTool.nextFrame(), width, height, QImage::Format_Rgb32);
  12. image = myprocessingcode(image);
  13. myPixmap = myPixmap.fromImage(image);
  14. myLabel.setPixmap(myPixmap);
  15. window.repaint();
  16. }
To copy to clipboard, switch view to plain text mode 
My idea would be to subclass QWidget and override the paintEvent() method.

following code untested!!
Qt Code:
  1. void VideoWidget::paintEvent()
  2. {
  3. QPainter p( this );
  4.  
  5. QImage image((uchar*)deviceAccessTool.nextFrame(), width, height, QImage::Format_Rgb32);
  6. myprocessingcode(&image);
  7.  
  8. p.drawImage (image.rect(), image);
  9. }
To copy to clipboard, switch view to plain text mode 


and somewhere else maybe....

Qt Code:
  1. {
  2. deviceAccessTool.loadNextFrame();
  3. connect(deviceAccessTool, SIGNAL(nextFrameAvailable()),
  4. videoWidget, SLOT(update()));
  5. }
To copy to clipboard, switch view to plain text mode