Good morning.
I'm writing a camera viewer and I have problem displaying the frames.
To display them I wrote a very little CameraRenderer ( inherited from QWidget ) widget.
Here the code.

.h
Qt Code:
  1. #ifndef _CAMERARENDERER_H_
  2. #define _CAMERARENDERER_H_
  3.  
  4. #include <QWidget>
  5.  
  6. class CCameraRenderer : public QWidget
  7. {
  8. Q_OBJECT
  9.  
  10. public:
  11. CCameraRenderer(QWidget* parent=0);
  12. ~CCameraRenderer();
  13.  
  14. void setImage(QPixmap*);
  15.  
  16. protected:
  17. /* paint event */
  18. virtual void paintEvent( QPaintEvent* event );
  19.  
  20. private:
  21. QPixmap* m_image;
  22. };
  23.  
  24. #endif //#ifndef _CAMERARENDERER_H_
To copy to clipboard, switch view to plain text mode 

.cpp
Qt Code:
  1. #include "CameraRenderer.h"
  2. /*Qt*/
  3. #include <QPainter>
  4.  
  5. CCameraRenderer::CCameraRenderer(QWidget* parent)
  6. : QWidget(parent)
  7. {
  8. setFixedSize( QSize(640, 480) );
  9.  
  10. m_image = new QPixmap();
  11. }
  12.  
  13. CCameraRenderer::~CCameraRenderer()
  14. {
  15. }
  16.  
  17. void CCameraRenderer::setImage(QPixmap* image)
  18. {
  19. //m_image = QPixmap();
  20. m_image = image;
  21. }
  22.  
  23. void CCameraRenderer::paintEvent( QPaintEvent* pe )
  24. {
  25. QPainter p(this);
  26. p.setRenderHint( QPainter::Antialiasing, true );
  27.  
  28. // image
  29. p.drawPixmap( 0, 0, *m_image );
  30. }
To copy to clipboard, switch view to plain text mode 


then I have the application where I have a QTimer and periodically I get a frame from the camera that I would display. The class that manage the camera is CVistaCamera.
Here the main code:

.h
Qt Code:
  1. class CVistaCamera : public QObject
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. CVistaCamera(QObject *parent = 0);
  7. ~CVistaCamera();
  8. int InitCamera();
  9. void CloseCamera();
  10.  
  11. VC_VARS* getStructPtr();
  12.  
  13. public slots:
  14. void onUpdate(); //<-- called in a timer event where I get a camera frame
  15.  
  16. signals:
  17. void sig_stopTimer();
  18. void sig_startTimer( int );
  19. void sig_updateDisplay( QPixmap* ); //<---should display the frame content
  20.  
  21. private:
  22. int m_fVcOpen;
  23.  
  24. VC_VARS* pVar;
  25.  
  26. unsigned char* pImageData;
  27. DWORD ImageSize;
  28. DWORD vcVideoSource;
  29.  
  30. QPixmap* pixmap;
  31. };
  32.  
  33. #endif //_VISTACAMERA_H_
To copy to clipboard, switch view to plain text mode 

and the main methods:
Qt Code:
  1. void CVistaCamera::onUpdate() //called periodically with a QTimer
  2. {
  3.  
  4. VC_VARS* pVc = getStructPtr();
  5. // get a frame
  6. rc = VcGetImage( pImageData, ImageSize, &retLen );
  7.  
  8. if ( rc == VC_SUCCESS )
  9. {
  10. pixmap->loadFromData( pImageData, ImageSize );
  11. emit sig_updateDisplay( pixmap );
  12. }
  13. else
  14. {
  15. // error - camera disconnected?
  16. VcClose();
  17. m_fVcOpen = 0;
  18. }
  19. }
To copy to clipboard, switch view to plain text mode 

the signal sig_updateDisplay is connected with a the slot onUpdateDisplay so:

Qt Code:
  1. connect( m_vistaCamera, SIGNAL( sig_updateDisplay(QPixmap*) ), this, SLOT( onUpdateDisplay(QPixmap*) ) );
To copy to clipboard, switch view to plain text mode 

and here the slot:
Qt Code:
  1. void VistaIrisCollector::onUpdateDisplay(QPixmap* pixmap )
  2. {
  3. ui.display->setImage( pixmap );
  4. ui.display->repaint();
  5. }
To copy to clipboard, switch view to plain text mode 

In the window I don't see nothing, I don't know why.
I would have a help.
Best Regards,
Franco