cross posting from [URL="https://stackoverflow.com/questions/47740565"]stackoverflow:
The following C++/Qt code is used to launch a modal dialog that prompts for a file selection:
dlg.setReadOnly(true);
dlg.setProxyModel(new OpenFileProxyModel);
dlg.setFileMode(FileDialog::ExistingFiles);
if (dlg.exec())
return dlg.selectedFiles();
QFileDialog dlg(parent, caption, dir, filter);
dlg.setOption(QFileDialog::DontUseNativeDialog);
dlg.setViewMode(QFileDialog::Detail);
dlg.setAcceptMode(QFileDialog::AcceptOpen);
dlg.setReadOnly(true);
dlg.setProxyModel(new OpenFileProxyModel);
dlg.setFileMode(FileDialog::ExistingFiles);
if (dlg.exec())
return dlg.selectedFiles();
To copy to clipboard, switch view to plain text mode
This is correctly executed. Then, however, the calling application proceeds to load the selected files, and updates a file list in the main window - before the modal dialog is properly closed. This results in a badly disfigured transient display. Part of the QFileDialog remain visible, while others are overwritten by updated parts of the main window.
How to prevent this behavior?
Other discussion threads suggest
qApp->processEvents();
which, however, has no effect here.
Bookmarks