How to display a variable of type QByteArray in Debug Window?
Unsolved
General and Desktop
-
Hi,
I want to display a QByteArray variable as 8-bit hex (2 characters) in Debug Window, not with qDebug.
I am attaching screenshoot for better understanding.
Thanks.Screenshoot
(I did not find any image embed function in forum, I have uploaded it on postimage.org) -
You may use something like this as a base for your own solution.
QString toDebug(const QByteArray & line) { QString s; uchar c; for ( int i=0 ; i < line.size() ; i++ ) { c = line[i]; if ( c >= 0x20 and c <= 126 ) { s.append(c); } else { s.append(QString("<%1>").arg(c, 2, 16, QChar('0'))); } } return s; }
-