Please nominate your Qt Champions for 2021!

Filedialog set folder problem

  • Hey!

    I have a FileDialog which I want to preset the folder path for. It works perfectly as long as the path is from a local disc like this:

    • C:\Deployment\Master\Work

    But if the path comes from a server disk like this:

    • \eunxosk-sfi0xx\users$\myUser\System\Desktop\myProject\Master/Work

    I get this error:
    @shellItem: SHCreateItemFromParsingName(/eunxosk-sfi0xx/users$/myUser/System/Desktop/myProject/Master/Work)) failed (An attempt was made to reference a token that does not exist.)--@

    Any help?

  • Did you double quote all backslashes?


  • Do I need to do so? :)

    I mean, why would that be necessary?

  • In C/C++ the backslash ("") character is the escape character. So for using the backslash as character you will have use the double backslash, so escaping the escape character, which makes it read as real letter-character.

  • Lifetime Qt Champion


    To simplify things, with Qt you can use the unix notation for all platforms so forward slashes, thus making it easier to avoid this kind of problem. Can you also test with a path that doesn't contain a $ ?

  • I actually used the forward slashes. The ones I showed you are after i converted them into backslashes (only for views sake). Seems to work without the $! Do you think that is what are causing the problem?

  • Lifetime Qt Champion

    It might be indeed, AFAIK $ is an unusual char in a path however it doesn't mean it should not work when using Qt. I think you should try asking on the interest mailing list to see if it's indeed the case. You'll find there Qt's developers/maintainers (this forum is more user oriented)

Log in to reply