void PhotoTableWindow::openProject(){ QString dir = QFileDialog::getExistingDirectory(this, tr("Choose directory"), rootDir, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if(dir != "") { prjDirectory = dir; loadRecent(); }}
void PhotoTableWindow::loadRecent(){ QString fileName; QImage img; QDir dir; dir.cd(prjDirectory); for(int i = 1; i < 25; i++) { fileName = QString::number(i) + ".jpg"; if(QFile::exists(fileName)) { bool b = img.load(fileName); qDebug() << "PhotoTableWindow::initLabels(): file " << fileName << " is found"; if(!b) { QMessageBox::critical(0, tr("Error!"), tr("Cannot load image!")); continue; } lblList[i]->setPixmap(QPixmap::fromImage(img.scaled(lblList[i]->width(), lblList[i]->height(), Qt::KeepAspectRatio))); lblList[i]->repaint(); isPhoto[i] = 1; } }}
void PhotoTableWindow::openProject(){ QString dir = QFileDialog::getExistingDirectory(this, tr("Choose directory"), rootDir, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if(dir != "") { prjDirectory = dir; QMetaObject::invokeMethod( this, "loadRecent", Qt::QueuedConnection ); }}
connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openProject()));