qfilesystemmodel

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

做~自己de王妃 提交于 2019-12-11 16:12:12
问题 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 QMimeData *data, Qt::DropActions supportedDropActions() const; }; in MainWindow I created model and initializied treeview MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); model = new MyFileSysModel(this);

My QFileSystemModel doesn't work as expected in PyQt

我只是一个虾纸丫 提交于 2019-12-11 09:26:40
问题 EDIT2: model.hasChildren(parentIndex) returns True , but model.rowCount(parentIndex) returns 0 . Is QFileSystemModel just fubar in PyQt? EDIT: With a bit of adaptation this all works exactly as it should if I use QDirModel. This is deprecated, but maybe QFileSystemModel hasn't been fully implemented in PyQt? I'm learning the Qt Model/View architecture at the moment, and I've found something that doesn't work as I'd expect it to. I've got the following code (adapted from Qt Model Classes):

How to refresh a QFileSystemModel in a QTreeView after files change through another process?

霸气de小男生 提交于 2019-12-11 02:33:46
问题 I have a QTreeView with a QFileSystemModel as the model. Files and directories load correctly. In my application workflow, a different process copies and overwrites files on the file system. However, my QTreeView does not update the item/row for the overwritten file (eg: the size and lastModified values for the file do not update to the new values). Using the file path, I'm able to get a FileInfo that DOES have the updated lastModified value. However, using that same path to grab the

PyQt: removing unnecessary columns

冷暖自知 提交于 2019-12-10 03:32:15
问题 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. 回答1: Get the QHeaderView of your TreeView by calling header() on it, the headerview knows about the columns and can hide them via hideSection 回答2: I believe, this post is a duplicate of: How can I remove columns from a QTreeView (using QDirModel)? The only difference is that here we are

Filtering QFilesystemModel

核能气质少年 提交于 2019-12-08 01:42:50
问题 I'm using a QFileSystemModel with a QListview to display all files from a directory. I'd like to filter that model to display some categories of files like : textual files : *.txt *.csv *.tab music : *.mp3 *.flac *.ogg movies : *.avi *.mkv My current code is : MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { Filemodel = new QFileSystemModel(this) ; Filemodel->setFilter( QDir::NoDotAndDotDot | QDir::Files ) ; proxy_model = new QSortFilterProxyModel();

Filtering QFilesystemModel

删除回忆录丶 提交于 2019-12-06 13:32:01
I'm using a QFileSystemModel with a QListview to display all files from a directory. I'd like to filter that model to display some categories of files like : textual files : *.txt *.csv *.tab music : *.mp3 *.flac *.ogg movies : *.avi *.mkv My current code is : MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { Filemodel = new QFileSystemModel(this) ; Filemodel->setFilter( QDir::NoDotAndDotDot | QDir::Files ) ; proxy_model = new QSortFilterProxyModel(); proxy_model ->setDynamicSortFilter(true); proxy_model ->setSourceModel( Filemodel ); proxy_model -

QT: QFileSystemModel _q_fileSystemChanged slot is executed on the UI thread which contradicts documentation

醉酒当歌 提交于 2019-12-06 06:31:39
问题 My UI is using QTreeView with QFileSystemModel to be able to select folders and files. The documentation for QFileSystemModel says that file structure update is done on a seperate thread which would mean the UI would not be blocked. However, this is not the case for me and I can't figure out the discreptency and how other people are not running into this issue. After debugging, I noticed that QFileSystemModel _q_fileSystemChanged slot which takes most of the time is still executed on the main

PyQt: QFileSystemModel checkbox filter

∥☆過路亽.° 提交于 2019-12-05 17:51:13
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 i check/uncheck QFileSystemModel checkboxes outside of the class with a wildcard search on fileName / fileType / fileSize? class CheckableDirModel(QtGui.QFileSystemModel): def __init__(self, parent=None): QtGui.QFileSystemModel.__init__(self, None) self.checks = {} def data(self, index, role=QtCore.Qt.DisplayRole): if role != QtCore.Qt

QFileSystemModel setRootPath

折月煮酒 提交于 2019-12-04 17:52:15
问题 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 also attempted using this code When i run the application, instead of showing the content of the “/Users” Folder, it shows the root drive (note: not the content of the drive). The folder does exist and i also tried using other folders. 回答1: Did you

QFileSystemModel setRootPath

天涯浪子 提交于 2019-12-03 11:53:46
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 also attempted using this code When i run the application, instead of showing the content of the “/Users” Folder, it shows the root drive (note: not the content of the drive). The folder does exist and i also tried using other folders. Did you try forcing the index to show the directory ? listView->setRootIndex(dirModel->index("/Users")); This works