Allow hiding / showing byte graphs in Frame Info. Double click on

graphs for magic.
This commit is contained in:
Collin Kidder
2023-01-17 22:09:39 -05:00
parent 45d6e02894
commit ffc9278380
4 changed files with 34 additions and 1 deletions
+1
View File
@@ -105,6 +105,7 @@ CANDataGrid::CANDataGrid(QWidget *parent) :
fire[x] = QColor::fromHsl(hue, 255, 127);
}
//the 0th entry should always be black and really stand out from the rest
fire[0] = Qt::black;
}
+31
View File
@@ -164,6 +164,7 @@ void FrameInfoWindow::setupByteGraph(QCustomPlot *plot, int num)
connect(plot, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(mousePress()));
connect(plot, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel()));
connect(plot, &QCustomPlot::mouseDoubleClick, this, &FrameInfoWindow::mouseDoubleClick);
}
void FrameInfoWindow::mousePress()
@@ -197,6 +198,36 @@ void FrameInfoWindow::mouseWheel()
plot->axisRect()->setRangeZoom(Qt::Horizontal|Qt::Vertical);
}
//two modes here. If none of the 8 sub graphs are hidden then hide all except the one the user
//just double clicked on. Otherwise unhide the 7 hidden ones
void FrameInfoWindow::mouseDoubleClick()
{
QCustomPlot *plot = qobject_cast<QCustomPlot *>(sender());
bool hideMode = true;
for (int i = 0; i < 8; i++)
{
if (ui->gridLower->itemAt(i)->widget()->isHidden()) hideMode = false;
}
if (hideMode)
{
for (int i = 0; i < 8; i++)
{
if (ui->gridLower->itemAt(i)->widget() == (plot)) qDebug() << "Idx " << i << " matched!";
else ui->gridLower->itemAt(i)->widget()->setHidden(true);
}
}
else
{
for (int i = 0; i < 8; i++)
{
ui->gridLower->itemAt(i)->widget()->setHidden(false);
}
}
}
void FrameInfoWindow::showEvent(QShowEvent* event)
{
QDialog::showEvent(event);
+1
View File
@@ -31,6 +31,7 @@ private slots:
void saveDetails();
void mousePress();
void mouseWheel();
void mouseDoubleClick();
private:
Ui::FrameInfoWindow *ui;
+1 -1
View File
@@ -61,9 +61,9 @@ GraphingWindow::GraphingWindow(const QVector<CANFrame> *frames, QWidget *parent)
// connect slot that ties some axis selections together (especially opposite axes):
connect(ui->graphingView, SIGNAL(selectionChangedByUser()), this, SLOT(selectionChanged()));
//connect up the mouse controls
connect(ui->graphingView, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(mousePress()));
connect(ui->graphingView, SIGNAL(plottableDoubleClick(QCPAbstractPlottable*,int,QMouseEvent*)), this, SLOT(plottableDoubleClick(QCPAbstractPlottable*,int,QMouseEvent*)));
connect(ui->graphingView, SIGNAL(plottableClick(QCPAbstractPlottable*,int,QMouseEvent*)), this, SLOT(plottableClick(QCPAbstractPlottable*,int,QMouseEvent*)));
connect(ui->graphingView, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(mousePress()));
connect(ui->graphingView, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel()));
// make bottom and left axes transfer their ranges to top and right axes: