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
QtWS25 Last Chance

Image showing in QLabel

Scheduled Pinned Locked Moved Unsolved General and Desktop
qlabelqpixmap
4 Posts 2 Posters 694 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 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
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 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
      0
      • Christian EhrlicherC Christian Ehrlicher

        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 last edited by
        #3

        @Christian-Ehrlicher Already tried that

        Christian EhrlicherC 1 Reply Last reply
        0
        • S Sai Raul

          @Christian-Ehrlicher Already tried that

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 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

          • Login

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