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. DragDrop and %

DragDrop and %

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 657 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.
  • tomwebT Offline
    tomwebT Offline
    tomweb
    wrote on last edited by
    #1

    Hello,
    i want to drag Dir- and File-Names in my app.
    When i drag from explorer "dir#%.txt" i receive "dir%23%25.txt" ( i use event->mimeData()->text() )
    When i drag same file from my a QTableWidget in my app to another window in same app, i receive "dir#%25.txt"
    No problems with unicode like "Æ⊜滪" , but why with # and %?

    I now replace "%23" -> "#" and "%25" -> "%" but i think, that's not the best solution.
    Is there a better possibility to get the right characters?
    And, to get ALL replaced characters (not sure, if it's enough to replace these 2 ones)

    And..is there a spec about this? I searched about one hour, but did not find anything.

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

      @tomweb said:

      dir#%.txt

      Hi it seems to be normal URL encoding

      http://www.w3schools.com/tags/ref_urlencode.asp

      Did u look if
      QMimeData::urls()
      contains other file name?

      Maybe you can convert it back to "dir#%.txt"
      with
      QString QUrl::fromPercentEncoding(const QByteArray &input)
      or some of the other URL functions.

      tomwebT 1 Reply Last reply
      2
      • mrjjM mrjj

        @tomweb said:

        dir#%.txt

        Hi it seems to be normal URL encoding

        http://www.w3schools.com/tags/ref_urlencode.asp

        Did u look if
        QMimeData::urls()
        contains other file name?

        Maybe you can convert it back to "dir#%.txt"
        with
        QString QUrl::fromPercentEncoding(const QByteArray &input)
        or some of the other URL functions.

        tomwebT Offline
        tomwebT Offline
        tomweb
        wrote on last edited by
        #3

        @mrjj
        Thank you, works.
        QList<QUrl> urlList = event->mimeData()->urls(); followed by QString f = urlList[urlNr].toString();
        has the same result.

        Regardles if i use mimeData()->text() or mimeData()->urls() i must use fromPercentEncoding
        now i use
        QString f = QUrl::fromPercentEncoding( urlList[urlNr].toString().toUtf8() );
        Have a nice Sunday

        1 Reply Last reply
        1

        • Login

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