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

old-commit-hash: 078f06dbaf
beeps
Dean Lee 2 years ago committed by GitHub
parent 5e1b64285f
commit 86266c0cea
  1. 6
      tools/cabana/util.cc

@ -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()) {

Loading…
Cancel
Save