MCPcopy Create free account
hub / github.com/Simsys/qhexedit2 / toReadable

Method toReadable

src/qhexedit.cpp:1145–1168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1143}
1144
1145QString QHexEdit::toReadable(const QByteArray &ba)
1146{
1147 QString result;
1148
1149 for (int i=0; i < ba.size(); i += 16)
1150 {
1151 QString addrStr = QString("%1").arg(_addressOffset + i, addressWidth(), 16, QChar('0'));
1152 QString hexStr;
1153 QString ascStr;
1154 for (int j=0; j<16; j++)
1155 {
1156 if ((i + j) < ba.size())
1157 {
1158 hexStr.append(" ").append(ba.mid(i+j, 1).toHex());
1159 char ch = ba[i + j];
1160 if ((ch < 0x20) || (ch > 0x7e))
1161 ch = '.';
1162 ascStr.append(QChar(ch));
1163 }
1164 }
1165 result += addrStr + " " + QString("%1").arg(hexStr, -48) + " " + QString("%1").arg(ascStr, -17) + "\n";
1166 }
1167 return result;
1168}
1169
1170void QHexEdit::updateCursor()
1171{

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected