How to Convert QBuffer to QString

You can convert QBuffer to QString using buffer function of the QBuffer. Here is how you can do it.

QBuffer b;
b.open(QBuffer::ReadWrite);
b.write("http://amin-ahmadi.com");
QString str = b.buffer();
qDebug() << str; // "http://amin-ahmadi.com"
b.close();


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.