Qt 6.12 LTS is out! See what's new in the release
blog
How to show a directory using QFileSystemModel
-
Re: [SOLVED]QFileSystemModel set root path
My current code shows all the drives. I only want to show the elements of a folder. Thank you very much.
-
Hi,
Set the root path to the one of the folder you want to show.
There's an example in the class details.
-
Hello, thanks for the quick reply. I'm already doing that. My code: (PySide6)
model = QFileSystemModel() model.setRootPath(folder_path) index = QModelIndex() self.file_explorer.setRootIndex(index) self.file_explorer.setModel(model) -
You are setting your view's root index to an invalid index.