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

Get QModelIndex from filepath and filename in QFileSystemModel

I need to get the QModelIndex from a filepath and filename in a QFileSystemModel. I saw there is the index function which takes a filepath but I don't know what the column argument should do.
maxwell
  • 357
  • 4
  • 14
0
votes
1 answer

PyQt QFileIconProvider class custom icons

I have a QTreeView with a QFileSystemModel to create a folder directory tree. As I am on Windows with the terrible default icons I want to create a few of my own (folder, network drive, etc). From reading the docs I see I need to create my own…
Spencer
  • 1,931
  • 1
  • 21
  • 44
0
votes
1 answer

QFileSystemModel and Proxy sort differently in QTreeView

I want to show only mounted drives sorted by drive letter in windows using Qt 5.10. Here is my test code: #include #include QStringList mountedDrives; class FSFilter : public QSortFilterProxyModel { public: …
Rory
  • 113
  • 8
0
votes
0 answers

QFileSystemModel and QTreeView

I show a QFileSystemModel through a QTreeView. Whenever the user clicks on a directory (expanded or not expanded) I want to get a list of the files inside this directory. void MyModel::selectionChanged(const QItemSelection& selected,const…
Jan Müller
  • 413
  • 3
  • 18
0
votes
1 answer

How to make QTreeView CheckBox Pre-Selected

I have a TreeView with QtGui.QFileSystemModel to render file system folders. My TreeView has a checkbox and checks & uncheck working fine. I want to pre-select all checkboxes on UI Load. please suggest how to make default selected checkbox for…
user2623906
0
votes
1 answer

PyQt4 QFileSystemModel duplicated index

I have a problem with QFileSystemModel.index When I select files or folders from treeview with one click of the mouse, the code prints the item selected twice. This is the part of the code where I am having the problem : import sys import os import…
seghier
  • 167
  • 1
  • 2
  • 11
0
votes
0 answers

How to show only files using QFileSystemModel and QTreeView?

I have tried few attempt to show only file names inside my folder and subfolder but no luck so far. Basically below is how my QTreeview looks like Here, Folder structure is like :- SV A_XML_Folder A_XML_Folder.xml B_XML_Folder …
Pawankumar Dubey
  • 387
  • 1
  • 6
  • 21
0
votes
1 answer

Why does my treeview in GUI with QFileSystemModel sometimes freezing when I copying file in separate thread (Qt)?

Here is my Model, that inherits QFileSystemModel class MyFileSysModel : public QFileSystemModel { Q_OBJECT public: MyFileSysModel( QObject *parent = 0); Qt::ItemFlags flags(const QModelIndex &index) const; bool dropMimeData(const…
Anton45
  • 11
0
votes
0 answers

QFileSystemModel keeps adding the current directory to the list even with QDir::Files filter

I'm using Qt5. The code is really simple and goes like this: struct DirEdit { QLineEdit *lineedit; QToolButton *button; QListView *view; QString dirPath; QFileSystemModel dirModel; bool ready {false}; }; Then in the source…
iksemyonov
  • 4,106
  • 1
  • 22
  • 42
0
votes
1 answer

Using QFileSystemModel to synchronise two views with different elements

I'm building a explorer like view with a directory tree / navigation pane using a QTreeView on the left side and an icon view on the right/main side using a QListView. The tree side should only show directories (preferable non empty directories…but…
Hhut
  • 1,128
  • 1
  • 12
  • 24
0
votes
1 answer

Simulating a directory tree platform-independently

I am using Qt and Ruby in an application where I have to manipulate some directories and rename/move files. However, prior to the actual manipulation I need to show a "preview", ie, simulation of the changes. What I've done on OS X and Linux is a…
0
votes
1 answer

How can I show windows shared folders in QFileSystemModel

I can show local files in QFileSystemModel dirModel = new…
utarid
  • 1,642
  • 4
  • 24
  • 38
0
votes
1 answer

Can't show anything above home directory in QFileSystemModel in Linux

I have the following code in Qt4.8 under Linux: QFileSystemModel* dir_model = new QFileSystemModel; dir_model->setRootPath("/usr"); ui->dir_tree->setModel(dir_model); Instead of showing "/usr" the tree widget shows my home directory. If I…
yesint
  • 145
  • 9
0
votes
1 answer

How QFileSystemModel setRootPath to another drive on linux

I have a drive labeled as "Local Data" mounted at "/media/Local Data". And my program directory is also in "/media/Local Data/Programming". I would like to set "Local Data" to be the root path of a QFileSystemModel. I cannot find a way to do…
tom
  • 1,302
  • 1
  • 16
  • 30
0
votes
1 answer

How to get selected items (QFiles & QDirs) from QFileSystemModel?

I have to do a file manager where I can rename, delete, copy files to a remote location (that part is finished) etc.. I think I need QFile and QDir to get the local side of the manager to work with the remote side. QFileSystemModel looks like an…
Masza
  • 331
  • 1
  • 3
  • 12