Interface for "save as" window in qt-Creator

0

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.

    
asked by Juan Sebastian 10.12.2016 в 03:10
source

1 answer

2

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);
}

    
answered by 10.12.2016 / 04:38
source