QFileDialog returns "C:\...\... that refers to a location is not available"



  • QFileDialog returns "C:\Users\Dar¡o That Refers to a location is not available"**

    I can not find a way to correct this message, the code is this:

    @QString file = QFileDialog :: GetOpenFileName (this,
                                                 tr ("Abrir un archivo"),
                                                 QDir::HomePath ()
                                                 tr ("Todos los archivos (.)"));@

    the QDir::HomePath() output is "C:\Users\Darío" (Darío with emphasis on i)

    the project.pro file has

    @CODECFORTR = UTF-8
    CODECFORSRC = UTF-8@

    the system is Windows 7, language is Spanish

    Thank you very much,

    regards,



  • This Works at me :
    @
    QString file = QFileDialog::getOpenFileName (this,
    tr ("Abrir un archivo"),
    QDir::homePath() ,
    tr ("Todos los archivos (.)"));
    @

    Have you make
    @
    #include <QFileDialog>
    #include <QDir>
    @


  • Moderators

    You need to check the home path setting:
    @
    qDebug() << QDir::homePath();
    @
    If it is wrong you can find under "QDir::homePath":http://doc.qt.io/qt-5/qdir.html#homePath the conditions applied to find the homePath. This may lead you to a wrong setting in your OS.



  • [quote author="Francknos" date="1424162077"]Have you make
    @
    #include <QFileDialog>
    #include <QDir>
    @
    [/quote]

    yes, I included those files

    [quote author="koahnig" date="1424164007"]You need to check the home path setting:
    @
    qDebug() << QDir::homePath();
    @
    If it is wrong you can find under "QDir::homePath":http://doc.qt.io/qt-5/qdir.html#homePath the conditions applied to find the homePath. This may lead you to a wrong setting in your OS.
    [/quote]

    @USERPROFILE=C:\Users\Darío
    HOMEDRIVE=C:
    HOMEPATH=\Users\Darío@

    look at this picture:

    !http://dysd.com.ar/imgforoqt/captura.jpg(Captura)!

    the problem is trying to open the desktop

    thank you very much,

    greetings,


  • Moderators

    The question is if there is the folder "C:/Users/Dario/Desktop" available?

    This could be named different because of Spanish version. However, I really doubt that this is the origin of the problem.

    Another thing may be your first name. The fourth letter does not look in the screen shots like a plain ASCII 'i'. It looks like a special Spanish character. IMHO that might be the cause.
    "QLocale":http://doc.qt.io/qt-5/qlocale.html may be of help. Unfortunately, I have not used QLocale before.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.