Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Clear File Selection in a QFileDialog
How do you clear which files are selected in a QFileDialog?
What do you mean by clear?
The user selects files. or deselects them.
I want to be able to programmatically deselect all highlighted files.
While the dialog is open?
I've created a custom file dialog. I make one instance of it in my code. When I open that dialog I select a file name. When I open it again, the same file name is selected. I don't want it to be selected when I open it the second or succeeding time.
Ahh. a QFileDialog, yes?
Have you tried to clear
I had tried yourdialog.selectFile( "");, but that didn't seem to work. I'll try to clear selectedFiles().
ok. else if its completely stupid then maybe just new it each time and use
setAttribute( Qt::WA_DeleteOnClose );
to clean up?
As if you create new instance, its should be impossible for it to remember. :)
Yeah. I thought about that too. Maybe I'm over-thinking this.
Well, one wonder where it remembers it.
Maybe its just the list itself.
so selectFile( ""); dont work as not select new and
selectedFiles is already empty.
so yeah, kill it ;)
Thanks! That did the trick. However, I had to delete each instance by hand, instead if using Qt::WA_DeleteOnClose, because I was referencing data from the dialog after it was closed.