0
votes

I'm having this problem. through QML i can access the that located on the same location with the QML file. and then I create a parser with C++ and pass the path through QML. e.g :

on QML

path = "myfolder/myfile.txt"
parser.setFile(path)

on C++

void QMLParser::setFile(QString filename)
{    
     QString path =  QCoreApplication::applicationDirPath();
     path.append(filename);
     qDebug() <<path;
    file = new QFile(path);
    if(!file->exists())
    {
        qDebug() << "File: " << file->fileName() << "tidak ditemukan";
        //        return myList;
    }
    if(!file->open(QIODevice::ReadOnly | QIODevice::Text))
    {
        qDebug() << "Tidak dapat membuka file" << file->fileName() << "untuk ditulis";
        //        return myList;
    }
}

eventually parser could not found the file. and then I check that the current Dir of the parser are not in the same dir of QML (of course). but I cannot find any way to set the QFile dir to the QML dir. how should I achieve it?

by the way, I'm developing for symbian^3 . just for you to know if there even any other issues

1

1 Answers

0
votes

Are you testing on the device or on the Qt simulator?

On the simulator you might run into the shadow build ( http://doc.qt.nokia.com/qtcreator-2.3/creator-glossary.html ) but that only forces you to deploy/package your files correctly. Have a look at the DEPLOYMENTFOLDER solution in http://developer.qt.nokia.com/forums/viewthread/2556.