Open gdementen opened 1 year ago
This does not seem as simple as I thought, unless we use some trickery.
Apparently, this is not supported anymore since Qt started its push to use system file dialogs where possible (in Qt4 it seems).
The only workaround I read about is to force using Qt builtin dialog instead of the system dialog by setting the QFileDialog::DontUseNativeDialog flag and then add our widget to the FileDialog manually.
Below is some C++ code doing that (from https://www.qtcentre.org/threads/42858-Creating-a-Custom-FileOpen-Dialog)
void FileDialog::addCheckBoxIn() {
QDialogButtonBox *box = qFindChild<QDialogButtonBox*>(this);
QBoxLayout *l = qFindChild<QBoxLayout*>(box);
QCheckBox *toProj = new QCheckBox("To Project:", box);
l->insertWidget(0, toProj);
}
Another, uglier but easier solution is to select the file using the normal/system dialog but open a second dialog with options. Or we could open that "options" dialog directly and have the filepath one of the options.
We need to add a checkbox in the File dialog or something like that