I need to display a string on a simulation screen. For that I’m supposed to read the text from an existing Filename.txt/Filename.csv file. The text parameter is updated as shown in the below piece of code. I need to access the string from a text file and use it in MarqueeText element. The Accessed string shall be used in the text field of the MarqueeText element.
MarqueeText {
id:scrolltext
width: 255
height: 48
anchors.verticalCenter: parent.horizontalCenter
text: //i need to access the string in text file to be displayed
}
Please help me with this. Thank you.
Follow the wiki page to read about accessing files in QML. Nokia Wiki Forum http://web.archive.org/web/20150227025348/http://developer.nokia.com/community/wiki/Reading_and_writing_files_in_QML
Summary:
Create a custom QML type, FileIO:
fileio.h
fileio.cpp
Register the new QML type:
Actual QML Usage: