cabana: draw message bytes at the same width (#27150)

old-commit-hash: 078f06dbaf
This commit is contained in:
Dean Lee
2023-01-31 02:56:03 +08:00
committed by GitHub
parent 5e1b64285f
commit 86266c0cea
+1 -5
View File
@@ -65,11 +65,6 @@ MessageBytesDelegate::MessageBytesDelegate(QObject *parent) : QStyledItemDelegat
}
void MessageBytesDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
QList<QVariant> colors = index.data(Qt::UserRole).toList();
if (colors.empty()) {
QStyledItemDelegate::paint(painter, option, index);
return;
}
QStyleOptionViewItemV4 opt = option;
initStyleOption(&opt, index);
@@ -87,6 +82,7 @@ void MessageBytesDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
int m = space.width() / 2;
const QMargins margins(m, m, m, m);
QList<QVariant> colors = index.data(Qt::UserRole).toList();
int i = 0;
for (auto &byte : opt.text.split(" ")) {
if (i < colors.size()) {