Multiple file selection and handling using QFileSystemModel
-
Hi,
I use setSelectionMode(QAbstractItemView::MultiSelection) in QTreeView to select multiple files, but I couldn't select more than one files using "Shift key", i.e select first file or directory, then selecting a another file/directory while holding "shift key" pressed, I expect the inbetween items would select but only clicked items.
Is it possible to select multiple items at an instant? if yest how it is handled in slot? because filesytemmodel->fileInfo(index).absoluteFilePath(); give only one file pathThanking you,
Ras -
bq. I use setSelectionMode(QAbstractItemView::MultiSelection) in QTreeView to select multiple files, but I couldn’t select more than one files using “Shift key”, i.e select first file or directory, then selecting a another file/directory while holding “shift key” pressed, I expect the inbetween items would select but only clicked items.
Use QAbstractItemView::ExtendedSelection for the desired behaviour
bq. Is it possible to select multiple items at an instant? if yest how it is handled in slot? because filesytemmodel->fileInfo(index).absoluteFilePath(); give only one file path
It will return the path for the file in the index. You have to iterate over the selection list to get the path of all the selected files (using each file's selection index)