how refresh treeview ?
-
Sorry for not good at English.
ui->treeViewVideo->setModel(model);
ui->treeViewVideo->setRootIndex(model->index("d:"));
ui->treeViewVideo->header()->setStretchLastSection(true);
ui->treeViewVideo->header()->setSectionResizeMode(QHeaderView::ResizeToContents);ui->treeViewVideo->setItemsExpandable(true);
ui->treeViewVideo->setAnimated(false);
ui->treeViewVideo->setIndentation(20);
ui->treeViewVideo->setSortingEnabled(true);
ui->treeViewVideo->sortByColumn(0, Qt::SortOrder::AscendingOrder);Copy the new file and you will see the new file.
I would like to see the file size increase in real time.
What should I do?
-
Model should emit
dataChanged()
signal. Since you don't specify what kind of model you are using, I can't tell you how to do it. If you have control over the model, make it emit the signal. If it's some ready-made class, then it might be tricky. -
@kirabbit said in how refresh treeview ?:
I would like to see the file size increase in real time.
QFileSystemModel does not support this out-of-the box, you have to write it by your own (which is not that trivial I would guess).
-
@kirabbit said in how refresh treeview ?:
I would like to see the file size increase in real time.
QFileSystemModel does not support this out-of-the box, you have to write it by your own (which is not that trivial I would guess).
@Christian-Ehrlicher said in how refresh treeview ?:
@kirabbit said in how refresh treeview ?:
I would like to see the file size increase in real time.
QFileSystemModel does not support this out-of-the box, you have to write it by your own (which is not that trivial I would guess).
@kirabbit
If that is so, and you need to know when a file size changes on disk, look at https://doc.qt.io/qt-5/qfilesystemwatcher.html#fileChanged signal.However, I'm thinking that needs placing on each file whose size you want to monitor, which is not a good idea, resource-wise....