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

I want to get working QFileSystemModel in Tree view?

I am making a program in which I want a FileTree (I already have this but not with QfileSystemMoodel and that makes it harder to do things afterwards). Here I have to be able to record a bit of sound with the file name entered (this works) in the…
Robbe
  • 17
  • 4
1
vote
1 answer

How to correct the "expand/collapse" icon on the QTreeView?

when you see this expand icon, you will think that there are something under the folder. but there is nothing. this issue causes a poor user experience. how to fix it? (** if the folder is empty, the expand icon is not displayed.) my code basically…
g2m.agent
  • 170
  • 1
  • 11
1
vote
1 answer

ObjectA.Signal.connect(ObjectB.Slot) not working. is my understanding correct?

This is my understanding of Signal and Slot, is it correct? When clicked, emitting a data(QModelIndex) to setRootIndex(). if correct. then why this code not working? treeView.clicked.connect(listView.setRootIndex) this is my ui: code: ... ... #…
g2m.agent
  • 170
  • 1
  • 11
1
vote
1 answer

How to filter the file list of QFileSystemModel by file name?

I want to make a manager that can display specific folders. suppose I want to filter out folders without extensions. Try 1: QFileSystemModel.setNameFilters() ... ... # get file data path = 'f:/tmp2' dirModel =…
g2m.agent
  • 170
  • 1
  • 11
1
vote
1 answer

How to set custom icons for QTreeView items relative to it's suffix

i'm using QTreeView and QFileSystemModel class to display folder structure at given path.Now i need help to customize the icons for tree item, according to file extension(i.e if file type is *.png set icon pngIcon.svg or if file type is *.mp4 then…
Ruchit
  • 661
  • 1
  • 6
  • 19
1
vote
1 answer

Two QListView box one showing files in a folder and one shows selected files from the first QListview

import sys from PyQt5.QtWidgets import * from PyQt5.QtCore import * class Widget(QWidget): def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) hlay = QHBoxLayout(self) self.listview =…
Cindy
  • 425
  • 1
  • 3
  • 10
1
vote
1 answer

QFileSystemModel disable QFileIconProvider

From looking around I've seen that the QFileIconProvider in the QFileSysetmModel can considerably slow things down. In my particular case I don't need it at all, but I can't find out how to easily just disable/remove it without causing a crash. This…
Spencer
  • 1,931
  • 1
  • 21
  • 44
1
vote
1 answer

How to set text color QTableView with QFileSystemModel in Qt?

I use Qtableview to show file and folder (only show icon, filename, size). I want to paint text color(all text in row) for a few specific files. Eg: file starts with 'ABC' is gray; 'XYZ' is red,...
kien bui
  • 1,760
  • 2
  • 17
  • 33
1
vote
1 answer

How to clear setNameFilters from a QFileSystemModel?

I have some code I am writing which displays the contents of a directory associated with a category whenever a new category is clicked on in a different list view. For convenience, I wanted to supply a filter option that would only display those…
Scott Jacobi
  • 119
  • 2
1
vote
1 answer

How to update file info in a QFileSystemModel?

First of all, this question is similar to this other one QFileSystemModel not updating when files change with the main difference than in this case I don't want to replace the entire model each time one of my files are updated. In the real world…
BPL
  • 9,632
  • 9
  • 59
  • 117
1
vote
2 answers

QFileSystemModel not updating when files change

I'm having trouble with QFileSystemModel not showing changes to files. When a file is first created it immediately shows up. But when the file itself changes, the size and timestamp don't update. I've made multiple attempts at trying to force the…
shao.lo
  • 4,387
  • 2
  • 33
  • 47
1
vote
1 answer

How to show DotDot path in QTableView using QFileSystemModel?

I apologize in advance for my English. I have QTableView with QFileSystemModel as model in my simple two-panel file manager. It displays files and directories correctly, but I want it to display DotDot line to move to the parent of the current…
1
vote
1 answer

Add additional information to items in a QTreeView/QFileSystemModel

I would like to render each item in a QTreeView differently based on a number of attributes stored in a database and based on whether the item is a folder or a file. However, I don't understand how the QTreeView or QFileSystemModel communicate with…
davideps
  • 541
  • 3
  • 13
1
vote
1 answer

Why doesn't drag and drop work in QFileSystemModel internally in my Qt application ?

I have very simple code, that displays file structure: class MainWindow : public QMainWindow { Q_OBJECT private: Ui::MainWindow *ui; QFileSystemModel model; QTreeView treeView; }; MainWindow::MainWindow(QWidget *parent) : …
edff
  • 11
  • 1
1
vote
1 answer

PyQt: current directory in QFileSystemModel

I am using following code from some official example: model = QFileSystemModel() model.setRootPath(QDir.currentPath()) view = QTreeView(parent=self); view.setModel(model) I expected it to expand directory structure…
gruszczy
  • 40,948
  • 31
  • 128
  • 181