From d402aa9a68ebcee718d03da7fdc35c953d4ba54d Mon Sep 17 00:00:00 2001 From: Joakim Lundborg Date: Thu, 5 Sep 2024 13:07:02 +0200 Subject: [PATCH] WIP: Make whole checkbox clickable Currently not working --- pages/pageloganalysis.cpp | 34 ++++++++++++++++++++++++++++++---- pages/pageloganalysis.ui | 14 +++++++------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/pages/pageloganalysis.cpp b/pages/pageloganalysis.cpp index c279feada..3e6f336f4 100644 --- a/pages/pageloganalysis.cpp +++ b/pages/pageloganalysis.cpp @@ -104,6 +104,32 @@ PageLogAnalysis::PageLogAnalysis(QWidget *parent) : } }); + connect(ui->dataTable, &QTableWidget::itemClicked, [this](QTableWidgetItem *item) { +printf("itemClicked %d %d %d\n", item->row(), item->column(), item->checkState()); + + if (item->column() == dataTableColY2){ + auto i1 = ui->dataTable->item(item->row(), dataTableColY2); + + if(i1->checkState() == Qt::Checked) { + ui->dataTable->item(i1->row(), dataTableColY2)->setCheckState(Qt::Unchecked); + + }else if(i1->checkState() == Qt::Unchecked) { + ui->dataTable->item(i1->row(), dataTableColY2)->setCheckState(Qt::Checked); + } + } + if (item->column() == dataTableColY1) { + auto i1 = ui->dataTable->item(item->row(), dataTableColY1); + + if(i1->checkState() == Qt::Checked) { + ui->dataTable->item(i1->row(), dataTableColY1)->setCheckState(Qt::Unchecked); + + }else if(i1->checkState() == Qt::Unchecked) { + ui->dataTable->item(i1->row(), dataTableColY1)->setCheckState(Qt::Checked); + } + } + }); + + m3dView = new Vesc3DView(this); m3dView->setMinimumWidth(200); m3dView->setRollPitchYaw(20, 20, 0); @@ -769,10 +795,10 @@ void PageLogAnalysis::updateGraphs() { QSet uniqueRows; - auto selectedRows = ui->dataTable->selectionModel()->selectedRows(); - for (const QModelIndex &index : selectedRows) { - uniqueRows.insert(index); - } + // auto selectedRows = ui->dataTable->selectionModel()->selectedRows(); + // for (const QModelIndex &index : selectedRows) { + // uniqueRows.insert(index); + // } for (int row = 0; row < ui->dataTable->rowCount(); ++row) { QTableWidgetItem *item; diff --git a/pages/pageloganalysis.ui b/pages/pageloganalysis.ui index cadc48391..2ad9474b5 100644 --- a/pages/pageloganalysis.ui +++ b/pages/pageloganalysis.ui @@ -568,25 +568,25 @@ - Y1 + Name - Y2 - - - <html><head/><body><p>Show this data series on the second Y axis to the right</p><p>Y axes will be autoscaled independently</p></body></html> + Value - Name + Y1 - Value + Y2 + + + <html><head/><body><p>Show this data series on the second Y axis to the right</p><p>Y axes will be autoscaled independently</p></body></html>