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

How to change file icons in QFileSystemModel

I have a code: QExplorer::QExplorer(QWidget *parent) { QString sPath = "D:/"; dirmodel = new QFileSystemModel(this); dirmodel->setRootPath(sPath); treeView = new QTreeView(this); treeView->setModel(dirmodel); …
why
  • 31
  • 5
0
votes
0 answers

Program crashes when filtering QFileSystemModel and using filePath function

I want to display a certain folder form my disk with PyQt5's QFileSystemModel and add a filter with LineEdit for searching. I applied the solution given here. The filtering works fine and it displays my folder. Now I want to add a function that…
Mazze
  • 383
  • 3
  • 13
0
votes
0 answers

Display a subdirectory (path retrieved from a string) inside a treeView

I have a QString fileName which stores in it a path to a subdirectory (eg. C:/Qt). I also have a treeView inside a dialog box. Upon starting the application, we browse a file and once the file/folder is selected, I save the path of the file/folder…
mandybuot
  • 15
  • 5
0
votes
1 answer

QFileSystemModel - display files in custom dirs

I have a complicated structure of dirs and files, and my goal is to showing files (not all, just files that i need) in one "root" dir, and hide all the rest. I tried work with row count() and data(), but that's gives nothing. index.row() never…
0
votes
0 answers

QTreeView with QFileSystemModel is clipping text instead of showing horizontal scrollbar

I'm using QTreeView together with QFileSystemModel to display content of a directory like this However as you can see, if the sub-directories go too deep, the text is clipped and becomes unreadable. I would like to rather have a horizontal…
Youda008
  • 1,788
  • 1
  • 17
  • 35
0
votes
1 answer

Drag and Drop not working in `QFileModelSystem`

I'm trying to make a drag and drop behavior in QFileSystemModel but because I have no experience in making a drag and drop before, I tried it first on QTreeView. (I attached the video of the behavior) Now that I'm fine with the behavior I want, I…
Eliazar
  • 301
  • 3
  • 13
0
votes
1 answer

Sudden app termination when using `sourceModel()` for `fileInfo()`

Some context: I made a QTreeView and set QFileSystemModel as its model. There are 2 TreeViews, the one on the right corresponds in the list of the project files in a directory, and the left one serves for the view of the connected files for that…
Eliazar
  • 301
  • 3
  • 13
0
votes
1 answer

Is it possible to create a `QFileSystemModel()` that only shows the file in a certain list?

I'm trying to make an app that shows all the connected files of a certain main file. When you click on a main file, it will show you the list of all files that needs it. As I've started making the app, I'm stuck here one whole day realizing how to…
Eliazar
  • 301
  • 3
  • 13
0
votes
0 answers

Is there a way to hide the system's main drive and show only connected devices in pyqt treeview

I'm using pyqt treview and QFileSystemModel to display my computer files and plugged in USB devices. What I want is to be able to detect when devices are connected to the computer and show only those in the treeview. For example, on windows, when I…
SorinT
  • 53
  • 1
  • 6
0
votes
0 answers

how to set a custom qfilesystemmodel in qfiledialog

I'd like to show a virtual file system alongside the normal file system in a qml file dialog. For that virtual file system i will use a customized class derived from qfilesystemmodel. However how can i tell the qml file dialog to use my custom…
lammermann
  • 13
  • 5
0
votes
1 answer

How can I prevent rowsInserted signal from QFileSystemModel in special cases?

i am programming a file explorer and I am using a QFileSysteModel as the base. I noticed that the methods QFileSystemModel::index() and QFileSystemModel::fetchMore causing the model to emit the signal rowsInserted. I have connected the rowsInserted…
Maitai
  • 42
  • 1
  • 10
0
votes
1 answer

Set a QStandartItem as Expandable without having a child item

i am trying to send a folder structure between two differnt programs which can be on different computers. On my server I have a QFileSystemModel and on my client I have a QTreeView which has a QStandardItemModel as a model. And i have a prebuild…
Maitai
  • 42
  • 1
  • 10
0
votes
1 answer

Qt MVC - Get filename when user clicks?

Okay, I have the following code: QFileSystemModel *model = new QFileSystemModel; model->setRootPath(QDir::currentPath()); model->setFilter(QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot | QDir::Readable | QDir::Writable |…
0
votes
0 answers

Display custom list of files in QTreeView using QFileSystemModel or QAbstractItemModel

I'm building an open source PySide6 app based on the custom file browser in QTreeView. I've already subclassed QFileSystemModel to display a custom column with some extra data. Now my goal is to display a specific subset of files (they can be…
0
votes
2 answers

Custom file browser implementation on PySide6

I would like to implement the file browser on PySide6, and my goals are: Display files and folders with .. always at the top (regardless of the sorting), so that the user could double click it and go up one level. After .. I'd like to display…
Code Your Dream
  • 347
  • 3
  • 11