Skip to content

Commit 5486068

Browse files
committed
qt: Implemented symbol representation of buffer
1 parent b58aed8 commit 5486068

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

qt/buffer_table_model.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ int BufferTableModel::columnCount(const QModelIndex & /*parent*/) const
2424

2525
QVariant BufferTableModel::data(const QModelIndex &index, int role) const
2626
{
27+
QString hexString;
28+
uint32_t start, end;
29+
2730
if (role == Qt::DisplayRole)
2831
{
2932
switch (index.column())
@@ -33,17 +36,22 @@ QVariant BufferTableModel::data(const QModelIndex &index, int role) const
3336
QChar('0'));
3437
break;
3538
case HEADER_HEX_COL:
36-
{
37-
QString hexString;
38-
uint32_t start = index.row() * ROW_DATA_SIZE,
39-
end = start + ROW_DATA_SIZE;
39+
start = index.row() * ROW_DATA_SIZE;
40+
end = start + ROW_DATA_SIZE;
4041

4142
for (uint32_t i = start; i < end && i < bufSize; i++)
42-
hexString.append(QString("%1 ").arg(buf[i], 2, 16, QChar('0')));
43+
{
44+
hexString.append(QString("%1 ").arg(buf[i], 2, 16,
45+
QChar('0')));
46+
}
4347
return hexString;
44-
}
4548
case HEADER_ANCII_COL:
46-
return QString("................");
49+
start = index.row() * ROW_DATA_SIZE;
50+
end = start + ROW_DATA_SIZE;
51+
52+
for (uint32_t i = start; i < end && i < bufSize; i++)
53+
hexString.append(QString("%1 ").arg(QChar(buf[i])));
54+
return hexString;
4755
}
4856
}
4957

0 commit comments

Comments
 (0)