Qt PNG图像未显示
我只是不能得到png图像显示,我检查它是否正确加载,这是做,但没有显示在我的空白画布。第三个用于显示图像。有人能看一下吗?谢谢Qt PNG图像未显示,qt,qimage,qpixmap,Qt,Qimage,Qpixmap,我只是不能得到png图像显示,我检查它是否正确加载,这是做,但没有显示在我的空白画布。第三个用于显示图像。有人能看一下吗?谢谢 QImage * QI = new QImage; bool Check = QI->load("test.png"); QGraphicsPixmapItem * QII = new QGraphicsPixmapItem(QPixmap::fromImage(*QI)); QRect ImagePanelArea1(0, MenuBarHeight,
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();
您确定您的项目不在场景之外吗
QGS3
QII
位于位置(0;0)
。场景的QRect
定义在点((屏幕宽度/3)*2,菜单项灯光)
和点(屏幕宽度/3,(屏幕高度/2)-菜单项灯光)
之间
因此,如果您的图像小于
(屏幕宽度/3)*2
,您的项目将不可见。您是否安装了所有这些qt图像库?默认情况下,不包括svg、png等的支持库。这是什么意思?我刚刚安装了qt安装程序我不知道抱歉:(请查看是否可以找到qtsvg4.dll
和其他图像库。我有一个名为qtsvg的文件夹,其中包含src文件。我的图像是64x64像素,为什么不显示?我的意思是,我的场景视图有边框,因此我假设如果图片比它们大,只需滚动图片即可。