Sorry, I'm quiet new in Qt and it's possible that somebody will laugh about this question, but I can't found a solution so I would like to ask you guys for al little bit help.
Actually I'm using Qt 4.3 together with Linux and MySQL 5.
From a MySql database I got "Hello\n World" using
QString test1
(query.
value(1).
toString())
QString test1(query.value(1).toString())
To copy to clipboard, switch view to plain text mode
In my database "Hello\n World" is stored as varschar(40).
Then for testing I have tried this:
QString test1
(query.
value(1).
toString());
qDebug() << query.value(1); // QVariant(QString, "Hello\World")
qDebug() << test1; // gives me "Hello\n World"
qDebug() << test2; // gives me "Hello
World"
QString test1(query.value(1).toString());
QString test2 = "Hello\n World";
qDebug() << query.value(1); // QVariant(QString, "Hello\World")
qDebug() << test1; // gives me "Hello\n World"
qDebug() << test2; // gives me "Hello
World"
To copy to clipboard, switch view to plain text mode
How it comes, that in test1 the newline character is ignored?
Thanks in advance
Guenther
Davao City, Philippines, Planet Earth
Bookmarks