FileDialog: Use well-known DeleteOnClose instead of custom lambda

The custom dialog-deleting lambda in QFileDialog::saveFileContent
is redundant

Change-Id: I03c2fa29ab0502b981460e34674a40a704a22e2d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Mikolaj Boc 2022-09-08 16:18:37 +02:00
parent f6908c4f71
commit 020f03c47e

View File

@ -2315,13 +2315,8 @@ void QFileDialog::getOpenFileContent(const QString &nameFilter, const std::funct
fileOpenCompleted(fileName, fileContent);
};
auto dialogClosed = [=](int code) {
Q_UNUSED(code);
dialog->deleteLater();
};
connect(dialog, &QFileDialog::fileSelected, fileSelected);
connect(dialog, &QFileDialog::finished, dialogClosed);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
#endif
}
@ -2360,13 +2355,8 @@ void QFileDialog::saveFileContent(const QByteArray &fileContent, const QString &
}
};
auto dialogClosed = [=](int code) {
Q_UNUSED(code);
dialog->deleteLater();
};
connect(dialog, &QFileDialog::fileSelected, fileSelected);
connect(dialog, &QFileDialog::finished, dialogClosed);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
#endif
}