Unsolved How can I temporarily disable treeview from updating, because these updating sometimes freezing and block GUI
-
I've created my class that inherits QFileSystemModel and I set this model to treeview
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);model = new MyFileSysModel(this); model->setRootPath("/"); ui->treeView->setModel(model); ui->treeView->setSelectionMode(QAbstractItemView::ExtendedSelection); ui->treeView->setDragEnabled(true); ui->treeView->viewport()->setAcceptDrops(true); ui->treeView->setDropIndicatorShown(true); ui->treeView->setDragDropMode(QAbstractItemView::DragDrop); ui->treeView->setAcceptDrops(true); ui->treeView->setDefaultDropAction(Qt::MoveAction); ui->treeView->blockSignals(true);
but when I copy files in separate thread (3 big files is enough), my treeview is freezing and doesn't work very well, I tried to blockSignals, but it didn't give me any results, it is still blocking. I can't totally disable treeview with setUpdatesEnabled(true), because I want to use it. Please, help me, I really desperate, this is very easy task and I can't solve this already two days.
-
Hi and welcome to devnet,
Are you sure the copy happens in that other thread ?
-
hey, yes, I am sure, Here is my code, that launches other thread:
class MoveFilesTask : public QObject, QRunnable { Q_OBJECT void run() { QFile::copy(source, destination); } void MoveFilesTask::runFilesTransfer(QString source, QString destination) { QThreadPool::globalInstance()->start(this); } };
-
Then can you describe exactly what you and your application are doing when the freezing happens ?