0

Now I am developing an application using bb cascades.We know that, it is possible to set strings contents such as text of a TextView etc... in layouts from String.xml file in Android.

Like this, is it possible to set texts in qml from any local file?

Thanks in Advance

Bojan Kogoj
  • 5,321
  • 3
  • 35
  • 57
Asha Soman
  • 1,846
  • 1
  • 18
  • 28

1 Answers1

0

Not completely sure what you want to do, however, you can definitely load data from .xml file from external source using the following code:

ListView {
    dataModel: XmlDataModel {
        source: "path/to/yourxmlname.xml"
    }
}

If you consider to access external data from c++, you can use the following code:

QFile file(QDir::currentPath() + "/path/to/your/file");
    if(!file.open(QIODevice::ReadWrite)) {
        qDebug() << "error opening file";
        return;
    }
    file.readall();
    file.close();

Then you can pass the data retreived to qml following the instruction: http://developer.blackberry.com/native/documentation/cascades/dev/integrating_cpp_qml/index.html

user25023
  • 1
  • 1