Image showing in QLabel
Unsolved
General and Desktop
-
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); }
-
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())
-
@Christian-Ehrlicher Already tried that
-
@Sai-Raul said in Image showing in QLabel:
Already tried that
And what was the outcome? Please update your code accordingly.