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. Multiple file selection and handling using QFileSystemModel

Multiple file selection and handling using QFileSystemModel

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

    Hi,
    I use setSelectionMode(QAbstractItemView::MultiSelection) in QTreeView to select multiple files, but I couldn't select more than one files using "Shift key", i.e select first file or directory, then selecting a another file/directory while holding "shift key" pressed, I expect the inbetween items would select but only clicked items.
    Is it possible to select multiple items at an instant? if yest how it is handled in slot? because filesytemmodel->fileInfo(index).absoluteFilePath(); give only one file path

    Thanking you,
    Ras

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Santosh Reddy
      wrote on last edited by
      #2

      bq. I use setSelectionMode(QAbstractItemView::MultiSelection) in QTreeView to select multiple files, but I couldn’t select more than one files using “Shift key”, i.e select first file or directory, then selecting a another file/directory while holding “shift key” pressed, I expect the inbetween items would select but only clicked items.

      Use QAbstractItemView::ExtendedSelection for the desired behaviour

      bq. Is it possible to select multiple items at an instant? if yest how it is handled in slot? because filesytemmodel->fileInfo(index).absoluteFilePath(); give only one file path

      It will return the path for the file in the index. You have to iterate over the selection list to get the path of all the selected files (using each file's selection index)

      SS

      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