Allow hiding / showing byte graphs in Frame Info. Double click on
graphs for magic.
This commit is contained in:
@@ -105,6 +105,7 @@ CANDataGrid::CANDataGrid(QWidget *parent) :
|
|||||||
fire[x] = QColor::fromHsl(hue, 255, 127);
|
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;
|
fire[0] = Qt::black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ void FrameInfoWindow::setupByteGraph(QCustomPlot *plot, int num)
|
|||||||
|
|
||||||
connect(plot, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(mousePress()));
|
connect(plot, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(mousePress()));
|
||||||
connect(plot, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel()));
|
connect(plot, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel()));
|
||||||
|
connect(plot, &QCustomPlot::mouseDoubleClick, this, &FrameInfoWindow::mouseDoubleClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameInfoWindow::mousePress()
|
void FrameInfoWindow::mousePress()
|
||||||
@@ -197,6 +198,36 @@ void FrameInfoWindow::mouseWheel()
|
|||||||
plot->axisRect()->setRangeZoom(Qt::Horizontal|Qt::Vertical);
|
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)
|
void FrameInfoWindow::showEvent(QShowEvent* event)
|
||||||
{
|
{
|
||||||
QDialog::showEvent(event);
|
QDialog::showEvent(event);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ private slots:
|
|||||||
void saveDetails();
|
void saveDetails();
|
||||||
void mousePress();
|
void mousePress();
|
||||||
void mouseWheel();
|
void mouseWheel();
|
||||||
|
void mouseDoubleClick();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::FrameInfoWindow *ui;
|
Ui::FrameInfoWindow *ui;
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ GraphingWindow::GraphingWindow(const QVector<CANFrame> *frames, QWidget *parent)
|
|||||||
// connect slot that ties some axis selections together (especially opposite axes):
|
// connect slot that ties some axis selections together (especially opposite axes):
|
||||||
connect(ui->graphingView, SIGNAL(selectionChangedByUser()), this, SLOT(selectionChanged()));
|
connect(ui->graphingView, SIGNAL(selectionChangedByUser()), this, SLOT(selectionChanged()));
|
||||||
//connect up the mouse controls
|
//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(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(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()));
|
connect(ui->graphingView, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel()));
|
||||||
|
|
||||||
// make bottom and left axes transfer their ranges to top and right axes:
|
// make bottom and left axes transfer their ranges to top and right axes:
|
||||||
|
|||||||
Reference in New Issue
Block a user