Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can I temporarily disable treeview from updating, because these updating sometimes freezing and block GUI

How can I temporarily disable treeview from updating, because these updating sometimes freezing and block GUI

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vbsdfn123
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Are you sure the copy happens in that other thread ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • V Offline
        V Offline
        vbsdfn123
        wrote on last edited by vbsdfn123
        #3

        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);
                }
        };
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then can you describe exactly what you and your application are doing when the freezing happens ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved