I am currently writing a real-time visualization tool for processing simulation data. The data are two-dimensional data like a pressure/temperature field. Currently, I am using QImage to manipulate the data and QPixmap to display those data but are there any better/faster way? Does QPixmap::fromImage() copy the data from the given image and how costly is that? The source code from my approach looks like this:
int main(int argc, char **argv) {
QApplication app(argc, argv);
QMainWindow* mainWindow = new QMainWindow(0, 0);
mainWindow->setMinimumSize(1024, 768);
mainWindow->show();
QGraphicsScene* scene = new QGraphicsScene();
QGraphicsView* view = new QGraphicsView(scene);
mainWindow->setCentralWidget(view);
QImage* image = new QImage(640, 480, QImage::Format_RGB32);
image->fill(0);
QGraphicsPixmapItem* item = scene->addPixmap(QPixmap::fromImage(*image));
item->setPos(0, 0);
// DO SOME CALCULATION AND SET PIXEL COLOR ON image
item->setPixmap(QPixmap::fromImage(*image));
return app.exec();