Downloading files from the FTP server

Now that we have successfully uploaded our first file to the FTP server, let's create the feature for downloading the file back onto our computer!

  1. First, open mainwindow.ui again and right-click on the Set Folder button. Select Go to slot... and pick the clicked() signal to create a slot function. The slot function is very simple; it will just open up a file selection dialog, but this time it will only let the user select a folder instead since we provided it with a QFileDialog::ShowDirsOnly flag:
void MainWindow::on_setFolderButton_clicked() { QString folder = QFileDialog::getExistingDirectory(this, tr("Open Directory"), qApp->applicationDirPath(), QFileDialog::ShowDirsOnly); ui->downloadPath->setText(folder); ...

Get Hands-On GUI Programming with C++ and Qt5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.