I am using the Native file dialog, so there is no layout()
but want to add an additional control to the dialog. The builtin Notepad application has a perfect example when they allow the user to select the desired encoding (see below, to the left of the "Save" button). Is it possible to add an additional control in Qt5 while still using the native dialog?
CodePudding user response:
TL;DR: Completely custom components are not available with native dialogs, filters can be controlled using QFileDialog::setNameFilters
.
Qt's implementation of the native windows file dialog uses ABI::Windows::Storage::Pickers
. You can check the implementation out here. Depending on the type of action you perform, the implementation uses IFileOpenPicker
, IFolderPicker
or IFileSavePicker
.
If you want to manipulate the native dialog, this class would have to provide you with the option to do so. We can find the documentation for the FileSavePicker
class here.
Going through the available options, you see that there is no interface to provide any specific custom UI element. If you would only need the filter, the QFileDialog provides you with the ability to set a filter using QFileDialog::setNameFilters
. If you need a completely custom control/functionality, you unfortunately have to provide your own QDialog.