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. QFileSystemModel doesn't support the network paths and external drives?

QFileSystemModel doesn't support the network paths and external drives?

Scheduled Pinned Locked Moved Unsolved General and Desktop
filesystemnetworkdriveexplorer
4 Posts 4 Posters 1.5k 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.
  • J Offline
    J Offline
    jeanmilost
    wrote on 14 Jan 2020, 16:23 last edited by
    #1

    Using Qt (Qt 5.13 more precisely), I want to create a file browser, as closest as possible as the Windows Explorer one. This file browser should be as simple as possible from the point of view of code, but as complete as possible from the point of view of the functionalities.

    I found that a QFileSystemModel model exists, and combined with a view, it may be used as a base for create my explorer. However I faced several serious limitations using this model. One of the most annoying is that I could found no option to show the external drives (USB drives, connected phones, ...) and the network paths (Neighbor network, ...). Setting the model to the root, I can see all my local drives, including the virtual ones (i.e those mounted with the subst command), but nothing else.

    I use this code to create my model and link it to a view on my interface:

    QFileSystemModel* pModel = new QFileSystemModel;
    pModel->setRootPath(pModel->myComputer().toString());
    ui.treeView->setModel(pModel);
    

    And I get this result:

    alt text

    The 4 first entries are physical drives, and the 4 last are virtual drives. But I cannot show nothing else, despite of all my retries to configure the model.

    How should I change the above code to also see the network and external drives?

    NOTE I also asked this question on Stack Overflow, here:
    https://stackoverflow.com/questions/59689177/qt-qfilesystemmodel-doesnt-support-the-network-paths-and-external-drives

    B 1 Reply Last reply 14 Jan 2020, 18:02
    0
    • J jeanmilost
      14 Jan 2020, 16:23

      Using Qt (Qt 5.13 more precisely), I want to create a file browser, as closest as possible as the Windows Explorer one. This file browser should be as simple as possible from the point of view of code, but as complete as possible from the point of view of the functionalities.

      I found that a QFileSystemModel model exists, and combined with a view, it may be used as a base for create my explorer. However I faced several serious limitations using this model. One of the most annoying is that I could found no option to show the external drives (USB drives, connected phones, ...) and the network paths (Neighbor network, ...). Setting the model to the root, I can see all my local drives, including the virtual ones (i.e those mounted with the subst command), but nothing else.

      I use this code to create my model and link it to a view on my interface:

      QFileSystemModel* pModel = new QFileSystemModel;
      pModel->setRootPath(pModel->myComputer().toString());
      ui.treeView->setModel(pModel);
      

      And I get this result:

      alt text

      The 4 first entries are physical drives, and the 4 last are virtual drives. But I cannot show nothing else, despite of all my retries to configure the model.

      How should I change the above code to also see the network and external drives?

      NOTE I also asked this question on Stack Overflow, here:
      https://stackoverflow.com/questions/59689177/qt-qfilesystemmodel-doesnt-support-the-network-paths-and-external-drives

      B Offline
      B Offline
      beecksche
      wrote on 14 Jan 2020, 18:02 last edited by
      #2

      @jeanmilost

      In the docs it's says that the model is for a local filesystem. So i don't think you can show network directories with it.

      I think the easiest way is to write your own file system model.

      J 1 Reply Last reply 14 Jan 2020, 18:21
      3
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 14 Jan 2020, 18:13 last edited by mrjj
        #3

        Hi
        On win 10, it shows
        Mounted USB and Mounted network shares. ( connect to a drive letter )

        How, it wont show phones, or the NetWork object.

        alt text

        NTPASS is usb stick and data (Z) is a mounted network share

        1 Reply Last reply
        2
        • B beecksche
          14 Jan 2020, 18:02

          @jeanmilost

          In the docs it's says that the model is for a local filesystem. So i don't think you can show network directories with it.

          I think the easiest way is to write your own file system model.

          J Offline
          J Offline
          JonB
          wrote on 14 Jan 2020, 18:21 last edited by JonB
          #4

          @beecksche said in QFileSystemModel doesn't support the network paths and external drives?:

          I think the easiest way is to write your own file system model.

          Or, presumably extend QFileSystemModel by subclassing it.

          @jeanmilost
          I just don't think you can access network, as per https://stackoverflow.com/a/33856139/489865 and @beecksche's comment above.

          1 Reply Last reply
          2

          1/4

          14 Jan 2020, 16:23

          • Login

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