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 refresh treeview ?

how refresh treeview ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 929 Views
  • 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.
  • K Offline
    K Offline
    kirabbit
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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.

      (Z(:^

      1 Reply Last reply
      3
      • K Offline
        K Offline
        kirabbit
        wrote on last edited by
        #3

        use model ----> QFileSystemModel *model;

        I'm sorry, but how do you use it?

        I searched a lot but couldn't find any results.

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @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).

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          JonBJ 1 Reply Last reply
          1
          • Christian EhrlicherC Christian Ehrlicher

            @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).

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #5

            @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....

            1 Reply Last reply
            1

            • Login

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