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!
- First, open
mainwindow.ui
again and right-click on theSet Folder
button. SelectGo to slot...
and pick theclicked()
signal to create aslot
function. Theslot
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 aQFileDialog::ShowDirsOnly
flag:
void MainWindow::on_setFolderButton_clicked() { QString folder = QFileDialog::getExistingDirectory(this, tr("Open Directory"), qApp->applicationDirPath(), QFileDialog::ShowDirsOnly); ui->downloadPath->setText(folder); }
- Then, right click on the
List Widget
and selectGo to slot...
This time around, we will pick theitemDoubleClicked(QListWidgetItem*)
option instead:

- When the user double-clicks on an item in the
List Widget
, the following function...