Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

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

    General and Desktop
    2
    4
    2033
    Loading More Posts
    • 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
      Alain38 last edited by

      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 Reply Quote 0
      • A
        Alain38 last edited by

        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 Reply Quote 0
        • D
          dachui @Alain38 last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • D
            dachui @Alain38 last edited by

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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post