Questions tagged [qfilesystemmodel]

A QFileSystemModel is a class from the Qt toolkit which provides a data model for the local filesystem.

The QFileSystemModel class gives access to the local filesystem. It provides functions for renaming and removing files and directories, and for creating new directories. In the simplest case, it can be used with a suitable display widget (such as a QTreeView) as part of a browser or filter.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

187 questions
4
votes
1 answer

How to add custom row in QFileSystemModel?

I am using QFileSystemModel to represent file structure through the QTreView. Everything works fine, but I need to add an additional row at some level of the tree. For example for now is: -root --row1 --row2 --row3 All these rows mapping…
v-odin
  • 53
  • 6
4
votes
1 answer

QFileSystemModel - Incremental update/pre-emptive update

From the Qt documentation: QFileSystemModel will not fetch any files or directories until setRootPath() is called. This will prevent any unnecessary querying on the file system until that point such as listing the drives on Windows. Unlike…
nf313743
  • 4,129
  • 8
  • 48
  • 63
4
votes
2 answers

Select all items in QListView and deselect all when directory is changed

I created a window like this The link! and when I select a directory I would like to select all items in the right Qlist, and when I change to a different directory, I would deselect the items in the previous directory and select all items in my…
Sally
  • 87
  • 2
  • 10
4
votes
4 answers

How to access Qt::DisplayRole and specify columns in TableView

The QFileSystemModel has the following data function: Variant QFileSystemModel::data(const QModelIndex &index, int role) const { Q_D(const QFileSystemModel); if (!index.isValid() || index.model() != this) return QVariant(); …
maxwell
  • 357
  • 4
  • 14
4
votes
1 answer

QT: QFileSystemModel _q_fileSystemChanged slot is executed on the UI thread which contradicts documentation

My UI is using QTreeView with QFileSystemModel to be able to select folders and files. The documentation for QFileSystemModel says that file structure update is done on a seperate thread which would mean the UI would not be blocked. However, this…
4
votes
2 answers

QTreeView with QFileSystemModel: How can I remove all columns except "Name"?

while I'm working on something in Qt5 that closely resembles a file manager, I try to implement a very basic tree view, showing only the directory names without any other information. However, (it seems that) QTreeView doesn't let me decide which…
r4ndom n00b
  • 89
  • 2
  • 8
4
votes
1 answer

Qt proxy model usage example

I am using a Qt 4's QFileSystemModel and QTreeView. I am writing a Windows Explorer like file manager, and want to make a tree more similar to Windows', where tree consist some shortcut paths like Desktop, My Documents. The only thing I want is to…
3
votes
2 answers

How to show only folders with specific files using QTreeView and QFileSystemModel?

I have a problem filtering specific folder using QTreeView and QFileSystemModel. I set my root QFileSystemModel to a specific folder - this works. But I want to show just folders that contain .jpg files. Is this possible? I filter .jpg files and…
Adriano Leal
  • 316
  • 1
  • 5
  • 20
3
votes
1 answer

QTreeView / QFileSystemModel: How do I limit tree depth?

I have a QTreeView with a QFileSystemModel as its model. I can't figure out how to limit the depth of the tree. I would have thought it would be a function of the model? What I mean is, if I set the depth to 1, for example, only the top level items…
3
votes
2 answers

How to get the *full* filepath of a selected file via QFileSystemModel?

How to get a filepath via QFileSystemModel? Selecting via selection model returns just file name, or drive name. Note, that just file name isn't enough. Whole filepath is needed.
smallB
  • 16,662
  • 33
  • 107
  • 151
3
votes
1 answer

QFileSystemModel() / QTreeView(): traverse model filesystem tree prior to view expansion

I wish to create a widget for an app created with PyQt5. I want the user to be able to select any subset of the files within a filesystem hierarchy below a specified directory. I have extended the QFileSystemModel to allow checking the elements in…
Caleb Howard
  • 45
  • 1
  • 6
3
votes
1 answer

How to Display List of Files in A specified directory

How to display in a ListView manner files in a directory specified in the code in a PyQt window example : Like in the right pane of this QFileSystemModelDialog app
X-Black...
  • 1,376
  • 2
  • 20
  • 28
3
votes
1 answer

QFileSystemModel hide certain files

What I'm looking for is pretty much the opposite of QFileSystemModel::setNameFilters(). I'd like to set filters that catch things I don't want to show, but let everything else through. I don't see any way to go through and hide certain files,…
Dane Larsen
  • 1,534
  • 2
  • 18
  • 27
3
votes
1 answer

QFileSystemModel retrieve filepath of clicked file

I am trying to create a file explorer where you can look up a file. When found, the user should be able to select the file he want to upload. Therefore I need the path of the selected file. Here is my current code: import sys from PyQt4.QtGui import…
freedome97
  • 167
  • 3
  • 15
3
votes
1 answer

Hide empty parent folders QTreeView/QFileSystemModel

So i have a tree viewas shown below; #QTreeView widget #Shows files in set directory self.treeView = QtWidgets.QTreeView(self.centralWidget) self.treeView.setSortingEnabled(True) self.treeView.setObjectName("treeView") …
L.John.B
  • 120
  • 1
  • 13
1
2
3
12 13