View Full Version : QFileDialog::getopenFileNames - File select order

9th October 2015, 18:06
I'm writing a small PyQt code to create a batch file listing the order which the files on my drive are processed
Using the QFiledialog getopenFilenames method I can select the files, however the order in which I selected the files is not preserved

It's important that I get the order of the users selection EXACTLY right, as I want to process the files in the selected order. But I see that the list returned by getOpenFileNames does not preserve the selection order.

Does anybody have any suggestion to capture the selection order?

I am using pyqt4 on windows

10th October 2015, 10:58
For that to work you need to keep track of selection as it happens.
I.e. you need to follow what is added or removed, not just whether something is selected or not.

For that you will have to handle the selection signals appropriately, e.g. using a QListView and connecting to the view's item selection model.
Once you have that it should be easy to put into a dialog that can then serve as your file dialog.