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
2
votes
2 answers

QFileSystemModel and QTreeView showing dirs only. How to hide expansion marks against the empty dirs?

I'm building somewhat like standard file explorer - left pane is for folders tree, and the right one to display files within selected folder. QTreeView with QFileSystemModel is used to display folders. Model's filter is set to QDir::Dirs |…
Kirill Gamazkov
  • 3,277
  • 1
  • 18
  • 22
2
votes
1 answer

QTreeView - remove expandable look on some elements

I'd like to remove expandable attribute on some elements in QTreeView (populated with model inherited from QFileSystemModel). I can easily collapse this elements right after they are expanded, but they will be still visible in QTreeView as…
Dejwi
  • 4,393
  • 12
  • 45
  • 74
2
votes
2 answers

QFileSystemModel sorting DirsFirst

How do you do to sort a QFileSystemModel with QDir::DirsFirst like in QDirModel? The QFileSystemModel does not have a setSorting method.
Yassir Ennazk
  • 6,970
  • 4
  • 31
  • 37
1
vote
0 answers

how to extract file path from QFileSystemModel?

def nukeScriptFolder(self, index = QModelIndex()): index = self.dirmodel.index(QDir.currentPath()) fileInfo = QtCore.QFileInfo(self.dirmodel.fileInfo(index)) #print fileInfo.fileName() #path =…
yashaswi
  • 7
  • 2
1
vote
2 answers

Files in QFileSystemModel are grey

I'm setting my QFileSystemModel with following filters: QDir::Filters( Dirs|AllDirs|Files|Drives|NoDotAndDotDot|AllEntries ) In my proxy model, I am using a regular expression to filter files by…
user336635
  • 2,081
  • 6
  • 24
  • 30
1
vote
2 answers

QFileSystemModel without displaying files (just directories)

How can I set QFileSystemModel to display just directories? Or is this impossible at all?
user336635
  • 2,081
  • 6
  • 24
  • 30
1
vote
0 answers

Strange behavior of QFileSystemModel::filepath

I've made selection on QFileSystemModel and now I'm trying to get those paths selected by doing: QList r = sel_model_->selectedIndexes(); QStringList result; for (int i = 0; i < r.size() ; i += 4)//four number of columns …
smallB
  • 16,662
  • 33
  • 107
  • 151
1
vote
1 answer

Concatenate Two QFileSystemModels

In this post, my goal is to concatenate two QFileSystemModels to one and display them together. (Lots of updates has been made) Context : In my C drive , I created the folder MyFolder…
温泽海
  • 216
  • 3
  • 16
1
vote
1 answer

How to filter by no extension in QFileSystemModel

The following code runs (after importing necessary libraries): class MainWindow(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle('MainWindow') self.layout = QHBoxLayout() …
温泽海
  • 216
  • 3
  • 16
1
vote
1 answer

QFileSystemModel doesn't emit fileRenamed signal

I am trying to watch the changes in a directory using QFileSystemModel. Whenever I rename a file in the root path, only the directoryLoaded() signal is emitted. I want the fileRenamed() signal to be emitted so that I know which file is renamed to a…
Yeakub
  • 13
  • 3
1
vote
1 answer

QFileSystemModel with Checkboxes

So, I have this simple PyQt5 code which is essentially a file explorer. I need to be able to select arbitrary files or groups of files (directories and all of the children). I would like to: Add a Checkbox next to each item If an item is…
Kory
  • 47
  • 5
1
vote
1 answer

How to set a starting point directory to a QTreeView?

Lets say I have this folders in my system: /home/rob/musics/... /home/rob/texts/... /home/rob/images/... I'm trying to create a qtreeview(I don't know if this is the most appropriate widget to that) to show only the folders/subfolders and files…
Roger_88
  • 477
  • 8
  • 19
1
vote
1 answer

PySide2 - Program crashes when calling QFileSystemModel.index()

I am trying to convert into Python the following C++ example from https://doc.qt.io/qt-5/model-view-programming.html#using-model-indexes : C++: QFileSystemModel *model = new QFileSystemModel; QModelIndex parentIndex =…
u2gilles
  • 6,888
  • 7
  • 51
  • 75
1
vote
1 answer

Indexing PyQt5 combobox when using QFileSystemModel

I need to select the default file that appears in a combobox from a directory listing of files. With a normal combobox, it is easy enough to find the index of the value you want using .findText, but this does not appear to work for QFileSystemModel…
1
vote
1 answer

QFileSystemModel setNameFilter format for files without extension

Is there any way to display all files without extension by using setNameFilters? I know how to do it with files with multiple extensions (like the .txt in the example below), but I don't know how to do it to detect files with no extension, rather…
laurapons
  • 971
  • 13
  • 32