Hi,

I have a set of raw image files. Referring to the tutorials, I have written a QImage plugin to read the raw files. and display.
I'm successfully able to display these sequnce of files continuosly. Code is as below.
I would like to know if the approach I have taken is the right one... Is this the practice usually followed.

Qt Code:
  1. Ui::MainWindow *ui;
  2. QImage rawImg;
  3. QPixmap *pixmap;
  4. QGraphicsPixmapItem *pixmapItem;
  5. Canvas *scene;
  6.  
  7. pixmap = new QPixmap(555, 313);
  8. pixmapItem = new QGraphicsPixmapItem();
  9. scene = new Canvas(0,0,798,598);
  10. scene->addItem(pixmapItem);
  11. ui->liveFeedView = new QGraphicsView();
  12. ui->liveFeedView->setScene(scene);
  13. ui->setupUi(this);
  14.  
  15. QTimer* updateTimer = new QTimer(this);
  16. QObject::connect(updateTimer,SIGNAL(timeout()),this,SLOT(doUpdate()));
  17. updateTimer->start(50);
To copy to clipboard, switch view to plain text mode 

"Canvas" is derived from QGraphicsScene. Finally the slot doUpdate is as below:

Qt Code:
  1. if(rawImg.loadFromData(imgData[i]))
  2. {
  3. QPainter painter;
  4. painter.begin(pixmap);
  5. painter.drawImage(0,0,rawImg);
  6. painter.end();
  7. pixmapItem->setPixmap(*pixmap);
  8.  
  9. ui->liveFeedView->setScene(scene);
  10. qDebug() << "File updated: " << i;
  11. }
  12. i++;
To copy to clipboard, switch view to plain text mode