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

QFileSystemModel setRootPath

I am attempting to create a Qt application which shows the contents of a folder (“Users” folder in Mac OS). Here is the code: QFileSystemModel *dirModel = new QFileSystemModel; dirModel->setRootPath("/Users"); ui->listView->setModel(dirModel); I…
tanto
  • 339
  • 1
  • 2
  • 11
11
votes
0 answers

PyQt: QFileSystemModel checkbox filter

I am trying to make a utility using python/pyqt to create a *.tar archive from a QFileSystemModel (including only those items that are checked). Now I want control of QFileSystemModel checkboxes to filter with fileName / fileType / fileSize. How can…
Ruchit
  • 661
  • 1
  • 6
  • 19
10
votes
1 answer

Difference between setRootPath and setRootIndex in QFileSystemModel

I'm new to QFileSystemModel class but I'm confused with the functions of setRootPath and setRootIndex
X-Black...
  • 1,376
  • 2
  • 20
  • 28
9
votes
3 answers

How to select the first item in a list view by default?

I am using QFileSystemModel along with QListView, and I want the first item shown by the model to get selected by default. How I do that every time I click an item ?
prakashpun
  • 259
  • 4
  • 19
8
votes
2 answers

PyQt: removing QTreeView columns

I am using QTreeView with QFileSystemModel. It displays columns like Size, Type, Modification Date, which I don't need. How can I remove them from the view? I can't find any removeColumn in model or in view.
gruszczy
  • 40,948
  • 31
  • 128
  • 181
7
votes
2 answers

How to create custom icons for QFileSystemModel in a background thread

I am making a file browser in qt for some custom design-files. I want to load their preview as their thumbnail and for that reason I am using QIconProvider to return the Icon to my QFileSystemModel. The problem is that the algorithm that creates the…
willy
  • 487
  • 5
  • 21
7
votes
2 answers

Python PyQt QFileSystemModel Root Path

This is the code i have to display a tree view of a directory called "C:\Myfolder". import sys from PyQt4 import QtGui,QtCore class Myview(QtGui.QMainWindow): def __init__(self,parent=None): QtGui.QMainWindow.__init__(self) …
Chris Aung
  • 9,152
  • 33
  • 82
  • 127
6
votes
1 answer

Conditionally change color of files in QListView connected to QFileSystemModel

I'm having a QListView with a QFileSystemModel. Based on a selection in a QTreeView, the QListView shows the content of the folder. Now I need to change the color of the filenames depending on some condition. The initial idea would be to iterate…
ImportanceOfBeingErnest
  • 321,279
  • 53
  • 665
  • 712
5
votes
2 answers

Qt: Browsing filesystem with QListView and QFileSystemModel. How to higlight first item in a folder?

I'm doing what the topic says on a system without keyboard/mouse, so I need to make this work "from code". When I change the RootIndex of the QListView I want to highlight the first row. Here's mainwindow.cpp from a small testproject I've…
anr78
  • 1,308
  • 2
  • 17
  • 31
5
votes
2 answers

Qt File Browser based on QML

It is easy to implement a file browser by using QFileSystemModel. But the listview UI is not pretty. So I want to implement a file browser using QML. the QML has model/view support. But how to display the filesystem tree in QML? Any clue would be…
catinred
  • 329
  • 4
  • 12
5
votes
0 answers

Using QFileSystemModel with ListView

I'm trying to create a simple ListView that I can use to browse the file system, using QFileSystem. First, I tried to use code I've found that worked for QDirModel: main.qml: ListView { id: list width: 300 height: 500 …
s3rius
  • 1,442
  • 1
  • 14
  • 26
5
votes
3 answers

QFileSystemModel rowCount does not work as expected

I am try an example in Model/View Programming. http://doc.qt.io/qt-5/model-view-programming.html To demonstrate how data can be retrieved from a model, using model indexes, we set up a QFileSystemModel without a view and display the names of files…
tom
  • 1,302
  • 1
  • 16
  • 30
5
votes
2 answers

QFileSystemModel custom icons?

In my project, I have a QTreeView displaying a location on my drive. I need to change all the icons of the files to a custom icon but leave the folders alone. I reimplemented QFileSystemModel and I was able to change ALL the icons. Any way to limit…
mrg95
  • 2,371
  • 11
  • 46
  • 89
5
votes
1 answer

Best way to list files in a QFileSystemModel()?

I'm beginning Qt/pySide programming and am trying to implement a simple QListView with QFileSystemModel as the model. I have this working and in addition have defined a name filter on the model. I'd like to get a list of all files in the QListView…
Lewis
  • 51
  • 1
  • 2
5
votes
2 answers

How to disable the double click file renaming behavior on QTreeView and QFileSystemModel in PyQt?

Simple question. I'd like to use F2 or Enter for rename, and double click to open a file. Using self.treeView.doubleClicked.connect(self.doubleclick) I can do things in my self.doubleClick method, but the renaming is still triggered. The model is…
iacopo
  • 663
  • 1
  • 7
  • 22
1
2 3
12 13