QFileSystemModel add Column
-
Hi there!
I see that there are serval posts regarding this topic but all are rather old and none really added a column to QFileSystemModel. So is it really possible to add a column?
My plan is to add two columns to hold a temp string per file and a bool value if this temp string was modified. This is what I did so far:
model = new FileModel(this); model->insertColumns(model->columnCount(),2);FileModel is my custom class that I derived from QFileSystemModel. I create indexes to access the two additional information like this:
QModelIndex noteChanged = createIndex(index.row(), 5);And access the data like this:
this->data(index);This is not working. Can it work in this way? I would like to use QFileSystemModel to have the option to rename files, add/delete files and watch a directory.
Alternatively I was wandering if I could add additional roles to the model. Like a Qt::TempNote and Qt::NoteChanged role, which would hold my additional values.
-
Hi,
You might want to check KExtraColumnsProxyModel to add your additional columns.