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. [QT 4.7.4] [SOLVED] refresh the list of drives in the QFileSystemModel
QtWS25 Last Chance

[QT 4.7.4] [SOLVED] refresh the list of drives in the QFileSystemModel

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.4k 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.
  • A Offline
    A Offline
    Alain38
    wrote on last edited by
    #1

    Hi,
    I have a treeview that is used to display a list of directories/files. So this treeview is associated to a QFileSystemModel (in fact a derived class as I must perform some specific filtering). When I am creating an element under an existing directory, the treeview is automatically updated. According to the documentation I supposed that a QFileSystemWatcher is running somewhere even if I have not created it (I suppose that it is an automatic creation). But, when I am connecting (or disconnecting) an USB key the treeview is not updated. So how can I force the cache of the QFileSystemWatcher to update in this case (and by the way how can I have access to this object)?.

    Thanks for your answers

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Alain38
      wrote on last edited by
      #2

      Ok,
      I finally found a way to do what I want. As I'm using my own model, I did a specific process for the root (myComputer) directory. In this case I populating "by hand", using QDir::drives() the content of the tree.

      D 2 Replies Last reply
      0
      • A Alain38

        Ok,
        I finally found a way to do what I want. As I'm using my own model, I did a specific process for the root (myComputer) directory. In this case I populating "by hand", using QDir::drives() the content of the tree.

        D Offline
        D Offline
        dachui
        wrote on last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • A Alain38

          Ok,
          I finally found a way to do what I want. As I'm using my own model, I did a specific process for the root (myComputer) directory. In this case I populating "by hand", using QDir::drives() the content of the tree.

          D Offline
          D Offline
          dachui
          wrote on last edited by
          #4

          @Alain38 what you mean is override "QVariant myComputer(int role)" ? if so, what should return using QDir::drives()?

          1 Reply Last reply
          0

          • Login

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