Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Image showing in QLabel
Forum Update on Monday, May 27th 2025

Image showing in QLabel

Scheduled Pinned Locked Moved Unsolved General and Desktop
qlabelqpixmap
4 Posts 2 Posters 700 Views
  • 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
    Sai Raul
    wrote on 17 Sept 2021, 04:54 last edited by
    #1

    Here is my first question, I'm working in QT with c++. I have to work in live image capturing. I have got live , capturing and save the image also, But i want to show that image in QLabel after click the image capture button.. Here in my code of image saving in local disk , It's working successfully, But i want to show that image in QLabel

    void OSA1::btn_image_capture_clicked()
    {
        QString name, date, time;
        name = ui.label_34->text();
        date = (QDateTime::currentDateTime().toString("ddMMyyyy"));
        time = (QDateTime::currentDateTime().toString("hhmmss"));
        QString path = QString(PARENT_FOLDER) + name + "/" + date + "/" + date + time + "/";
        qDebug() << "Path: " << path;
        QDir dir(path);
        if (!dir.exists())
            dir.mkpath(".");
        full_Path = path + "fundus.png";
    
       QPixmap pix(full_Path);
        ui.label_59->setPixmap(pix);
        qDebug() << "pix" << pix;
        ui.label_59->show();
    
        cameraCGLive->imgSavePath = full_Path;
        cameraCGLive->fundusImageSave = true;
    
        ui.stackedWidget->setCurrentIndex(1);
        ui.stackedWidget_2->setVisible(true);
        ui.stackedWidget_2->setCurrentIndex(5);
    }
    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 17 Sept 2021, 04:57 last edited by
      #2

      And you're sure the file exists when you try to load it into a QPixmap? Please add some checks to make sure it is (e.g. QFile::exists(), QPixmap::load())

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      S 1 Reply Last reply 17 Sept 2021, 05:27
      0
      • C Christian Ehrlicher
        17 Sept 2021, 04:57

        And you're sure the file exists when you try to load it into a QPixmap? Please add some checks to make sure it is (e.g. QFile::exists(), QPixmap::load())

        S Offline
        S Offline
        Sai Raul
        wrote on 17 Sept 2021, 05:27 last edited by
        #3

        @Christian-Ehrlicher Already tried that

        C 1 Reply Last reply 17 Sept 2021, 05:30
        0
        • S Sai Raul
          17 Sept 2021, 05:27

          @Christian-Ehrlicher Already tried that

          C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 17 Sept 2021, 05:30 last edited by Christian Ehrlicher
          #4

          @Sai-Raul said in Image showing in QLabel:

          Already tried that

          And what was the outcome? Please update your code accordingly.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1

          4/4

          17 Sept 2021, 05:30

          • Login

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