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 and QTreeView with drag-drop/rename/delete
QtWS25 Last Chance

QFileSystemModel and QTreeView with drag-drop/rename/delete

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

    I have a QFileSystemModel and QTreeVIew working well as a basic directory browser filtering certain file names.
    Is it possible to make it behave like the left side of a file dialog or basic explorer, so that I can drag/drop folders and affect the underlying file-system, as well as right click to rename and delete? Or do I have to piece all these functions together by hand to give those basic file management functions?

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

      Hi and welcome to devnet,

      IIRC, you must disable QFileSystemModel's readOnly property and it should work.

      Hope it helps

      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
      0
      • P Offline
        P Offline
        pmh4514
        wrote on last edited by
        #3

        Hi, thank you.

        I tried this and it works well for renaming folders and files. Is there built-in ability to drag/drop to move, and delete?

        thanks!

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

          You're welcome !

          It's explained in the documentation "here":http://qt-project.org/doc/qt-5/model-view-programming.html#using-drag-and-drop-with-item-views

          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
          0

          • Login

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