Reputation: 2540
I want to display the contents of a QList
just like how it is displayed in the console with qDebug()
For example:
QList<QNetworkCookie> cookies = mManager->cookieJar()->cookiesForUrl(mUrl);
qDebug() << "COOKIES for" << mUrl.host() << cookies;
Output:
QNetworkCookie("MSession=kr6i819jbvkorherbe76oh23c7; domain=website.com; path=/)"
Is there a function that I can use?
Upvotes: 2
Views: 4353
Reputation: 2073
You can create a QDebug
object that will store anything streamed into it, inside a string. Here is it:
QString str;
QDebug dStream(&str);
dStream << mUrl.host();
Now you can put str
wherever you want. For example a QTextBrowser
:
ui->textBrowser->insertPlainText(str);
This should work everywhere that qDebug()
works. Because qDebug()
itself returns a QDebug
object according to this documentation.
Upvotes: 4