Does anyone know the way that, given a button in QT, that I assign to save something and, when pressed, I am displayed a window of save as ?
That is, that window that opens when we download something and asks us where we want to store it.
Does anyone know the way that, given a button in QT, that I assign to save something and, when pressed, I am displayed a window of save as ?
That is, that window that opens when we download something and asks us where we want to store it.
You must use the function: QString QFileDialog::getSaveFileName(QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), const QString & filter = QString(), QString * selectedFilter = 0, Options options = 0)
In the slot that receives the signal of clicked()
, in my case void on_pushButton_clicked()
you would execute that function.
For example in my case I add it to a QLineEdit:
void MainWindow::on_pushButton_clicked()
{
QString filename = QFileDialog::getSaveFileName(this, "Save file");
ui->lineEdit->setText(filename);
}