Fix to sniffer when viewing bits, output formatting change for ID
This commit is contained in:
@@ -43,17 +43,17 @@ void SnifferDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
|
|||||||
{
|
{
|
||||||
//qDebug() << "SnifferDelegate Paint Event";
|
//qDebug() << "SnifferDelegate Paint Event";
|
||||||
|
|
||||||
if (index.column() < 2) //allow default handling of the first two columns
|
if (index.column() < 3) //allow default handling of the first two columns
|
||||||
{
|
{
|
||||||
QItemDelegate::paint(painter, option, index);
|
QItemDelegate::paint(painter, option, index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index.column() > 9) return;
|
if (index.column() > 10) return;
|
||||||
|
|
||||||
int x;
|
int x;
|
||||||
SnifferItem *item = static_cast<SnifferItem*>(index.internalPointer());
|
SnifferItem *item = static_cast<SnifferItem*>(index.internalPointer());
|
||||||
int idx = index.column() - 2;
|
int idx = index.column() - 3;
|
||||||
int val = item->getData(idx);
|
int val = item->getData(idx);
|
||||||
int prevVal = item->getLastData(idx);
|
int prevVal = item->getLastData(idx);
|
||||||
int notchPattern = item->getNotchPattern(idx);
|
int notchPattern = item->getNotchPattern(idx);
|
||||||
@@ -70,7 +70,7 @@ void SnifferDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
|
|||||||
//qDebug() << "XSpan" << xSpan << " YSpan " << ySpan;
|
//qDebug() << "XSpan" << xSpan << " YSpan " << ySpan;
|
||||||
|
|
||||||
int xSector = xSpan / 8;
|
int xSector = xSpan / 8;
|
||||||
int v = item->getSeqInterval(index.column() - 2) * 10;
|
int v = item->getSeqInterval(index.column() - 3) * 10;
|
||||||
if (v > 225) v = 225;
|
if (v > 225) v = 225;
|
||||||
if (v < 0) v = 0;
|
if (v < 0) v = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -66,9 +66,10 @@ QVariant SnifferModel::data(const QModelIndex &index, int role) const
|
|||||||
case tc::DELTA:
|
case tc::DELTA:
|
||||||
return QString::number(item->getDelta(), 'f');
|
return QString::number(item->getDelta(), 'f');
|
||||||
case tc::FREQUENCY:
|
case tc::FREQUENCY:
|
||||||
|
if (item->getDelta() == 0) return QString("0 hz");
|
||||||
return QString("%1 hz").arg(qRound(1.00 / item->getDelta()));
|
return QString("%1 hz").arg(qRound(1.00 / item->getDelta()));
|
||||||
case tc::ID:
|
case tc::ID:
|
||||||
return "0x" + QString("%1").arg(item->getId(), 5, 16, QLatin1Char(' ')).toUpper();
|
return "0x" + QString("%1").arg(item->getId(), 5, 16, QLatin1Char('0')).toUpper();
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -272,7 +273,7 @@ void SnifferModel::refresh()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* refresh data */
|
/* refresh data */
|
||||||
dataChanged(createIndex(0, 0),
|
emit dataChanged(createIndex(0, 0),
|
||||||
createIndex(rowCount()-1, columnCount()-1), QVector<int>(Qt::DisplayRole));
|
createIndex(rowCount()-1, columnCount()-1), QVector<int>(Qt::DisplayRole));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user