Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Drag and Drop a directory
Qt 6.12 LTS is out! See what's new in the release blog

Drag and Drop a directory

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 501 Views 2 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.
  • PerdrixP Online
    PerdrixP Online
    Perdrix
    wrote on last edited by
    #1

    I'm accepting drops of type "text/uri-list"

    In the code that handles the dropEvent, I can write:

    QList<QUrl> urls = event->mimeData()->urls;
    for (int i = 0; i != urls.size(); ++i)
    {
        QString name = urls[i].toLocalFile();
    
    }
    

    What is the recommended code to distinguish what "name" is (file or directory)?

    Thanks
    David

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mpergand
      wrote on last edited by mpergand
      #2

      QFileInfo :

      bool isAbsolute() const
      bool isBundle() const
      bool isDir() const
      bool isExecutable() const
      bool isFile() const
      bool isHidden() const
      bool isNativePath() const
      bool isReadable() const
      bool isRelative() const
      bool isRoot() const
      bool isSymLink() const
      bool isWritable() const

      1 Reply Last reply
      1
      • PerdrixP Online
        PerdrixP Online
        Perdrix
        wrote on last edited by
        #3

        Thank you

        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
        • Unsolved