Qt Framework implements many convenience functions inside QByteArray for quickly handling of raw data. One of the widely used encoding methods is Base64 and if you’re with Qt, you can easily convert any string (QString) to/from Base64.
You can convert QBuffer to QString using buffer function of the QBuffer. Here is how you can do it.
QString str = b.buffer();
qDebug() << str; // “http://amin-ahmadi.com”
The best solution for this would be to go through standard C++ and it means this:
Let’s say you have a QString, like this:
QString s = “www.amin-ahmadi.com”;
First convert it to std::string and then use its c_str method, like this: