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
+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);