Added hex labeling option to graphs in flowview and frame info windows, a few tweaks for potential QT6 support
This commit is contained in:
+11
-1
@@ -3,6 +3,7 @@
|
||||
#include "mainwindow.h"
|
||||
#include "helpwindow.h"
|
||||
#include "filterutility.h"
|
||||
#include "qcpaxistickerhex.h"
|
||||
|
||||
const QColor FlowViewWindow::graphColors[8] = {Qt::blue, Qt::green, Qt::black, Qt::red, //0 1 2 3
|
||||
Qt::gray, Qt::yellow, Qt::cyan, Qt::darkMagenta}; //4 5 6 7
|
||||
@@ -34,6 +35,11 @@ FlowViewWindow::FlowViewWindow(const QVector<CANFrame> *frames, QWidget *parent)
|
||||
|
||||
ui->graphView->xAxis->setRange(0, 8);
|
||||
ui->graphView->yAxis->setRange(-10, 265); //run range a bit outside possible number so they aren't plotted in a hard to see place
|
||||
if (useHexTicker)
|
||||
{
|
||||
QSharedPointer<QCPAxisTickerHex> hexTicker(new QCPAxisTickerHex);
|
||||
ui->graphView->yAxis->setTicker(hexTicker);
|
||||
}
|
||||
ui->graphView->axisRect()->setupFullAxesBox();
|
||||
|
||||
QCPItemText *textLabel = new QCPItemText(ui->graphView);
|
||||
@@ -46,7 +52,9 @@ FlowViewWindow::FlowViewWindow(const QVector<CANFrame> *frames, QWidget *parent)
|
||||
textLabel->setPen(QPen(Qt::black)); // show black border around text
|
||||
|
||||
ui->graphView->xAxis->setLabel("Time Axis");
|
||||
ui->graphView->yAxis->setLabel("Value Axis");
|
||||
if (useHexTicker) ui->graphView->yAxis->setLabel("Value Axis (HEX)");
|
||||
else ui->graphView->yAxis->setLabel("Value Axis (dec)");
|
||||
|
||||
QFont legendFont = font();
|
||||
legendFont.setPointSize(10);
|
||||
QFont legendSelectedFont = font();
|
||||
@@ -150,6 +158,7 @@ void FlowViewWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
writeSettings();
|
||||
emit rejected(); //can be picked up by main window if needed
|
||||
}
|
||||
|
||||
void FlowViewWindow::readSettings()
|
||||
@@ -178,6 +187,7 @@ void FlowViewWindow::readSettings()
|
||||
|
||||
secondsMode = settings.value("Main/TimeSeconds", false).toBool();
|
||||
openGLMode = settings.value("Main/UseOpenGL", false).toBool();
|
||||
useHexTicker = settings.value("FlowView/GraphHex", false).toBool();
|
||||
}
|
||||
|
||||
void FlowViewWindow::writeSettings()
|
||||
|
||||
@@ -58,6 +58,7 @@ private:
|
||||
static const QColor graphColors[8];
|
||||
bool secondsMode;
|
||||
bool openGLMode;
|
||||
bool useHexTicker;
|
||||
QVector<double> x[8], y[8];
|
||||
QCPGraph *graphRef[8];
|
||||
|
||||
|
||||
+10
-2
@@ -5,6 +5,7 @@
|
||||
#include <QtDebug>
|
||||
#include <vector>
|
||||
#include "filterutility.h"
|
||||
#include "qcpaxistickerhex.h"
|
||||
|
||||
const QColor FrameInfoWindow::byteGraphColors[8] = {Qt::blue, Qt::green, Qt::black, Qt::red, //0 1 2 3
|
||||
Qt::gray, Qt::yellow, Qt::cyan, Qt::darkMagenta}; //4 5 6 7
|
||||
@@ -57,10 +58,16 @@ FrameInfoWindow::FrameInfoWindow(const QVector<CANFrame> *frames, QWidget *paren
|
||||
|
||||
ui->graphBytes->xAxis->setRange(0, 63);
|
||||
ui->graphBytes->yAxis->setRange(0, 265);
|
||||
if (useHexTicker)
|
||||
{
|
||||
QSharedPointer<QCPAxisTickerHex> hexTicker(new QCPAxisTickerHex);
|
||||
ui->graphBytes->yAxis->setTicker(hexTicker);
|
||||
}
|
||||
ui->graphBytes->axisRect()->setupFullAxesBox();
|
||||
|
||||
ui->graphBytes->xAxis->setLabel("Time");
|
||||
ui->graphBytes->yAxis->setLabel("Value");
|
||||
if (useHexTicker) ui->graphBytes->yAxis->setLabel("Value (HEX)");
|
||||
else ui->graphBytes->yAxis->setLabel("Value (Dec)");
|
||||
|
||||
ui->graphBytes->legend->setVisible(false);
|
||||
|
||||
@@ -154,6 +161,7 @@ void FrameInfoWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
writeSettings();
|
||||
emit rejected();
|
||||
}
|
||||
|
||||
void FrameInfoWindow::readSettings()
|
||||
@@ -175,7 +183,7 @@ void FrameInfoWindow::readSettings()
|
||||
move(Utility::constrainedWindowPos(settings.value("FrameInfo/WindowPos", QPoint(50, 50)).toPoint()));
|
||||
}
|
||||
useOpenGL = settings.value("Main/UseOpenGL", false).toBool();
|
||||
|
||||
useHexTicker = settings.value("InfoCompare/GraphHex", false).toBool();
|
||||
}
|
||||
|
||||
void FrameInfoWindow::writeSettings()
|
||||
|
||||
@@ -34,6 +34,7 @@ private:
|
||||
QList<CANFrame> frameCache;
|
||||
const QVector<CANFrame> *modelFrames;
|
||||
bool useOpenGL;
|
||||
bool useHexTicker;
|
||||
static const QColor byteGraphColors[8];
|
||||
static QPen bytePens[8];
|
||||
DBCHandler *dbcHandler;
|
||||
|
||||
Reference in New Issue
Block a user