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