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 to move one file to another dir by using treeview(QFilesystemmodel)
Forum Updated to NodeBB v4.3 + New Features

how to move one file to another dir by using treeview(QFilesystemmodel)

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 357 Views 1 Watching
  • 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
    pineapple
    wrote on 20 Jun 2021, 15:48 last edited by
    #1

    I am using the treeview as the view to search file in rootdir. but as a noob , I cant apply drag and drop function to drag one file item to another dir,or rename delete file at treeview .as I using the ui file to load the uiform I cant override the treeview function. is it possible to make it happen without override the function? or just set in the Qdesigner software.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 20 Jun 2021, 16:10 last edited by
      #2

      Hi,

      The model is by default read-only. You can change that using the setReadOnly method.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      P 1 Reply Last reply 20 Jun 2021, 16:24
      1
      • S SGaist
        20 Jun 2021, 16:10

        Hi,

        The model is by default read-only. You can change that using the setReadOnly method.

        P Offline
        P Offline
        pineapple
        wrote on 20 Jun 2021, 16:24 last edited by
        #3

        @SGaist thanks! it works well .one more question , how to set cut the file(not copy) when moves the file to another dir.and how to set the right click options in tree view?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 20 Jun 2021, 18:16 last edited by
          #4

          That is two questions.

          The same you do in your file explorer, using modifier keys. Usually alt if memory serves well.

          You can connect the customContextMenuRequested signal after setting the contextMenuPolicy.

          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
            pineapple
            wrote on 21 Jun 2021, 01:13 last edited by
            #5

            thanks very much but the alt key with mouse drag seems not work

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 21 Jun 2021, 19:54 last edited by
              #6

              Did you check the other modifier keys ?

              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

              1/6

              20 Jun 2021, 15:48

              • Login

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