Make timestamp formatting use QVariant for better sorting by timestamp.
This commit is contained in:
@@ -179,6 +179,7 @@ void ISOTP_InterpreterWindow::updatedFrames(int numFrames)
|
||||
|
||||
void ISOTP_InterpreterWindow::headerClicked(int logicalIndex)
|
||||
{
|
||||
ui->tableIsoFrames->setSortingEnabled(false);
|
||||
ui->tableIsoFrames->sortByColumn(logicalIndex);
|
||||
}
|
||||
|
||||
@@ -261,9 +262,13 @@ void ISOTP_InterpreterWindow::newISOMessage(ISOTP_MESSAGE msg)
|
||||
messages.append(msg);
|
||||
|
||||
rowNum = ui->tableIsoFrames->rowCount();
|
||||
|
||||
ui->tableIsoFrames->insertRow(rowNum);
|
||||
|
||||
ui->tableIsoFrames->setItem(rowNum, 0, new QTableWidgetItem(Utility::formatTimestamp(msg.timestamp)));
|
||||
QTableWidgetItem *item = new QTableWidgetItem;
|
||||
item->setData(Qt::EditRole, Utility::formatTimestamp(msg.timestamp));
|
||||
//ui->tableIsoFrames->setItem(rowNum, 0, (double)msg.timestamp, Utility::formatTimestamp(msg.timestamp)));
|
||||
ui->tableIsoFrames->setItem(rowNum, 0, item);
|
||||
ui->tableIsoFrames->setItem(rowNum, 1, new QTableWidgetItem(QString::number(msg.ID, 16)));
|
||||
ui->tableIsoFrames->setItem(rowNum, 2, new QTableWidgetItem(QString::number(msg.bus)));
|
||||
if (msg.isReceived) ui->tableIsoFrames->setItem(rowNum, 3, new QTableWidgetItem("Rx"));
|
||||
|
||||
@@ -89,7 +89,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listFilter"/>
|
||||
<widget class="QListWidget" name="listFilter">
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
|
||||
@@ -128,13 +128,13 @@ public:
|
||||
return output;
|
||||
}
|
||||
|
||||
static QString formatTimestamp(uint64_t timestamp)
|
||||
static QVariant formatTimestamp(uint64_t timestamp)
|
||||
{
|
||||
if (!sysTimeMode) {
|
||||
if (!secondsMode) return QString::number(timestamp);
|
||||
else return QString::number((double)timestamp / 1000000.0, 'f', 6);
|
||||
if (!secondsMode) return (unsigned long long)(timestamp);
|
||||
else return (double)timestamp / 1000000.0;
|
||||
}
|
||||
else return QDateTime::fromMSecsSinceEpoch(timestamp / 1000).toString(timeFormat);
|
||||
else return QDateTime::fromMSecsSinceEpoch(timestamp / 1000);
|
||||
}
|
||||
|
||||
//parses the input string to grab as much of it as possible while staying alpha numeric
|
||||
|
||||
Reference in New Issue
Block a user