Here is my code:

Qt Code:
  1. QImage camImage;
  2. ........
  3. .......
  4. // Loop ...
  5. while(camSwitch != false)
  6. {
  7. // Wait 5000 MillSeconds for a frame
  8. if(Ret == FCE_NOERROR)
  9. Ret = FGGetFrame(hCamera, &Frame, 5000);
  10.  
  11. if(Ret == FCE_NOERROR)
  12. Ret = FGPutFrame(hCamera, &Frame);
  13.  
  14. cvNamedWindow("1", CV_WINDOW_AUTOSIZE);
  15.  
  16. camImage = QImage::QImage(Frame.pData, 640, 480, QImage::Format_Indexed8);
  17. camImage.setColorTable(grayscales);
  18.  
  19. Display->scene()->setBackgroundBrush(QBrush::QBrush(camImage));
  20. Display->fitInView(0,0,640,480);
  21. cvWaitKey(50);
  22. }
To copy to clipboard, switch view to plain text mode 

Frame.pData is the real time frame with type unsigned char *
Line 14 & 21 are 2 functions of OpenCv(I hope you know that.) Line 14 made a new window. And line 21 ist a wait function. When i don't use these 2 functions, the program run to crash. This is comic.
Display is the object of QGraphicsview. Although i have set up the size of Display in 640*480 in QtDesigner, but wenn i don't use fitInView(0,0,640,480), the frame is not displayed automatically. So i have to use fitInView.
Have i too many error?

Thanks!