C++ GUI using QT
- by user1488019
I want to build a c++ GUI using Qt plaform. this a part of my code which is about opening an image file.
i used this method to open the image, but when i choose it from a specific folder nothing is shown (no image).
void MainWindow::openI()
{
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open File"), QDir::currentPath());
if (!fileName.isEmpty()) {
QImage image(fileName);
if (image.isNull()) {
QMessageBox::information(this, tr("Image Viewer"),
tr("Cannot load %1.").arg(fileName));
return;
}
}
}
Please help me!! this is a small part of my project