View Single Post
Berserk's Avatar
Posts: 199 | Thanked: 156 times | Joined on May 2010 @ Holland
#124
Originally Posted by D-Iivil View Post
However the function does not work, I get nothing into QString called "oldfont1" when trying to do it like this:
Code:
    QFile file("/etc/hildon/theme/colors.config");
    QTextStream stream ( &file );
    QString line;
    QHash<QString, QString> variables;
    while( !stream.atEnd()) {
         line = stream.readLine();
         QStringList splittedLine = line.split("=");
         variables.insert(splittedLine.at(0), splittedLine.at(1));
    }
    file.close();
    QString oldfont1 = variables.value("DefaultTextColor");
Although I didn't see it in the above code, does it contain something like the following?
Code:
file.open(QFile::ReadOnly);
I did see some "if not opened in readonly" things in the last posts, but not an explicit .open() function.

Or does a QFile open the file directly after declaring it?

I thought that.. if it's not opened, nothing is read, and the QString stays empty.
__________________
Wallpaeper - Desktop background manager (in Extras!)
Config Reader - Export all Gconf to an HTML file + compare feature (Extras-testing)
Even though these programs are available for free, I would appreciate any donations
 

The Following User Says Thank You to Berserk For This Useful Post: