我只是无法显示 png 图像,我检查它是否正确加载,但我的空白画布上没有显示任何内容。第三个用于显示图像。有人可以快速浏览一下吗?谢谢。
QImage * QI = new QImage;
bool Check = QI->load("test.png");
QGraphicsPixmapItem * QII = new QGraphicsPixmapItem(QPixmap::fromImage(*QI));
QRect ImagePanelArea1(0, MenuBarHeight,
ScreenWidth / 3, (ScreenHeight / 2) - MenuBarHeight);
QRect ImagePanelArea2(ScreenWidth / 3, MenuBarHeight,
ScreenWidth / 3, (ScreenHeight / 2) - MenuBarHeight);
QRect ImagePanelArea3((ScreenWidth / 3) * 2, MenuBarHeight,
ScreenWidth / 3, (ScreenHeight / 2) - MenuBarHeight);
QGraphicsScene * QGS1 = new QGraphicsScene(ImagePanelArea1, this);
QGraphicsScene * QGS2 = new QGraphicsScene(ImagePanelArea2, this);
QGraphicsScene * QGS3 = new QGraphicsScene(ImagePanelArea3, this);
QGS3->addItem(QII);
QGraphicsView * QGV1 = new QGraphicsView(QGS1, this);
QGV1->setGeometry(ImagePanelArea1);
QGV1->show();
QGraphicsView * QGV2 = new QGraphicsView(QGS2, this);
QGV2->setGeometry(ImagePanelArea2);
QGV2->show();
QGraphicsView * QGV3 = new QGraphicsView(QGS3, this);
QGV3->setGeometry(ImagePanelArea3); QGV3->show();