Unsolved Displaying BMP in QT c++
-
Hi All,
i am trying to display BMP in QT c++ using below code.
main(){
QApplication a(argc, argv);
QGraphicsScene scene;
QGraphicsView view(&scene);
QPixmap qp = QPixmap("http://guest:p2guest@192.168.55.3/contents/2/icon/08615L.bmp");
if(qp.isNull())
{
printf("Yes its null\n");
}
else
{
QGraphicsPixmapItem item(QPixmap("http://guest:p2guest@192.168.55.3/contents/2/icon/08615L.bmp"));
scene.addItem(&item);
}
view.show();
return a.exec();}
Control comes to line if(qp.isNull()){
} and goes inside. means qp is null.why Qp is null.
i have used same url to display this bmp from other c++ program and bmp is displayed correctly. it means this url is correct.
but using Qt with above code qp is null.
please suggest me.
Thanks
Shashi -
Hi,
QPixmap works with local file path not with remote URLs. First get the files using e.g. QNetworkAccessManager and then load them in a QPixmap.