简体   繁体   中英

How to save multiple images using QFileDialog and boost

I have small gui that has N.1 QGraphicsView and N.1 QPushButton . After I upload some images I am saving them in a specific folder on my Desktop. For this operation I am combining QFileDialog together with the library boost . Program runs but images are not being saved in the targeted folder, what am I missing?

See below the snipped of code I am using for the save QPushButton :

void MainWindow::on_saveToFileBtnCamB_clicked()
{
    QString rectB = QFileDialog::getExistingDirectory(this, tr("Choose an image directory to load"),
                                                     fileCamRectB, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
    boost::filesystem::path pb(rectB.toStdString());
    for(int i=0;i<finishedImages.size();i++)
    {
        finishedImages[i].getB().setSavePath(pb);
        finishedImages[i].getB().save();
        ui->progressBarSaveB->setValue(i);
    }
    dirB.setPath(rectB);
    ui->progressBarSaveB->setValue(finishedImages.size());
    finishedImages.clear();
}

在提出问题后,正确答案是Jarod42给出的初始答案,我在复制并粘贴错误:

finishedImages[i].getB().setSavePath(pb / ("imge_" + std::to_string(i) + ".extention");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM