How to Read Textline from File to Global Variable/Text-String?
This is my first Project with Qt and Sailfish SDK and some things are seemed very confusing and not to be straight forward like i know that from LUA-Coding.
I found out read a textline can be reached with this code:
#include QFile
#include QString
#include QTextStream
QFile file("/home/defaultuser/title.txt");
QTextStream in(&file);
QString title = in.readLine();
But where to place it? Outside or Inside that main-function in project.cpp?:
int main(int argc, char *argv[])
{âŚ}
And will âtitleâ be a global Variable/Text-String that i can use in CoverPage.qml too?:
Label {
x: Theme.horizontalPageMargin
width: parent.width - 2*x
text: title
color: Theme.highlightColor
font.bold: true
wrapMode: Text.WordWrap
font.pixelSize: Theme.fontSizeExtraSmall
}