Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Displaying BMP in QT c++

Displaying BMP in QT c++

Scheduled Pinned Locked Moved Unsolved C++ Gurus
2 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shashi prasad
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved