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
1
vote
1 answer

How do I retrieve the system icon for a file in python or qt?

I have the path to a file/folder. How can I get the icon image in the system for this file/folder? I'm writing a customized file browse model for a QTreeView and would like to display the icon like what the QFileSystemModel does.
user110
  • 315
  • 1
  • 11
1
vote
0 answers

Group image sequence in a QFileSystemModel

I am using QFileSystemModel to represent file structure through the QTreeView. It works fine except that instead of displaying all image files in a directory, I would like to group all image files to a single expandable image sequence node, i.e. it…
user110
  • 315
  • 1
  • 11
1
vote
2 answers

Hide those folders don't have filtered Files

I am working on QTreeviews, One has all the drives in it. and the other one displays all the files and folders corresponding to those drives. I have applied filters for some particular files. So it shows all those folders which have those…
Ashish
  • 219
  • 2
  • 6
  • 22
1
vote
1 answer

how to update QFileSystemModel when drive is added/removed?

I am using QFileSystemModel with QTreeView to display the contents of root directory, now want to refresh the qtreeview whenever a drive is added or removed. Tried with a refresh push button to achieve this with a slot, to delete the model and…
Prady
  • 663
  • 3
  • 11
  • 28
1
vote
0 answers

Qt UI stalling with poor performance of QFileSystemModel

I am using QFileSystemModel to parse a directory structure with 20,000+ files and subdirectories on a Mac. QFileSystemModel takes around 8-10secs to populate and during that time the UI stalls. As per Qt documentation, the file system parsing is…
Soumya Das
  • 1,635
  • 2
  • 19
  • 28
1
vote
1 answer

Qt Item Delegate

I am new to Qt and am slowly finding my way around. My goal is to have a QListView of a QFileSytemModel where the names of the files in the icons wraps, similar to the behavior found on any OS where the text gets split if the name is too long. From…
Black Dynamite
  • 4,067
  • 5
  • 40
  • 75
1
vote
1 answer

Using QFileSystemModel in a QCompleter

How does one use QFileSystemModel in the context of a QCompleter? It looks like a better choice than QDirModel as it is non UI-blocking. The following snippet doesn't seem to do anything. QLineEdit* l = new QLineEdit ; QCompleter* c = new QCompleter…
swongu
  • 2,229
  • 3
  • 19
  • 24
1
vote
1 answer

Failing to remove attributes of Tree View in Qt

I am a newbie in QT. I am working on a app where I need to display the FileSystem using a treeview. Basically I have a widget in my .ui file on which I have put a Treeview. Then in my .cpp file I have written the following code: model = new…
StonedJesus
  • 397
  • 1
  • 5
  • 26
1
vote
3 answers

QTreeView / QFileSystemModel set header labels

Pretty simple task but I didn't manage to find anything useful in documentation. I want a QTreeView to contain a single column called "Files" with data from QFileSystemView. Here's what I've got: QFileSystemModel *projectFiles = new…
jaho
  • 4,852
  • 6
  • 40
  • 66
1
vote
2 answers

How to exclude dirs in QFileSystemModel?

I use this code. QFileSystemModel* fsModel = new QFileSystemModel(this); fsModel->setFilter(QDir::NoDotAndDotDot | QDir::Dirs ); I can not understand how to exclude some folders.
1
vote
4 answers

How do you hide file extensions on a QFileSystemModel

I have bound a QFileSystemModel to a QTreeView. The QFileSystemModel has readOnly set to false so the user can rename files... However I don't want the user to accidentally rename a file and forget its extension as that will result in its exclusion…
Yassir Ennazk
  • 6,970
  • 4
  • 31
  • 37
1
vote
0 answers

Python generated file changes not detected by QFileSystemModel

Using PyQt and Python I came across the following issue: Set up a QFileSystemModel, call setRootPath() and hook up to the dataChanged signal. Open a new file from Python and write some text into it. Then close it. Reopen the file in append mode and…
repoman
  • 3,485
  • 2
  • 16
  • 15
0
votes
1 answer

Displaying just the files with correct extension

I'm trying in QFileSystemModel display just files with extention *.txt and the other types shaded/grayed out: proxy_ is of type QSortFilterProxyModel model_ is of type QFileSystemModel Here's my code: proxy_->setFilterWildcard("*.txt"); …
user336635
  • 2,081
  • 6
  • 24
  • 30
0
votes
0 answers

Drive selection via QFileSystemModel

When I select a drive let's say "D" and store it via filePath(QModelIndex) this is not recognized by Windows as a D:\ but as a D: which are two different things I've just learned. Is there a way to make a filePath from QFileSystemModel returns the…
smallB
  • 16,662
  • 33
  • 107
  • 151
0
votes
1 answer

Picking selection just for first column (drives, folders, files) of a QFileSystemModel?

In QFileSystemModel when selection is made on it, the return type is a QList. Is there a way to get selection just for the first column (the column with drives, folders and files)?
smallB
  • 16,662
  • 33
  • 107
  • 151