QImage img(data_image, Nc, Nl, Nc, QImage::Format_Indexed8); QVector<QRgb> color_table; for(int i = 0; i < 256; ++i) color_table.append(qRgb(i,i,i)); img.setColorTable(color_table); QImage optimal_img = img.convertToFormat(QImage::Format_RGB32); QGraphicsScene* scene = new QGraphicsScene(this); QGraphicsPixmapItem item(QPixmap::fromImage(optimal_img)); scene->addItem(&item); ui->graphicsView->setScene(scene);
I'm trying to display the image in this way, but the QGraphicScene is empty. Tried to display text ( QGraphicsScene::addText
) - it is displayed. The picture is not empty, I checked. What could be the problem?
QLabel
? - alexis031182