Skip to content

Commit

Permalink
WIP: Make whole checkbox clickable
Browse files Browse the repository at this point in the history
Currently not working
  • Loading branch information
cortex committed Sep 5, 2024
1 parent cdef571 commit d402aa9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
34 changes: 30 additions & 4 deletions pages/pageloganalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -769,10 +795,10 @@ void PageLogAnalysis::updateGraphs()
{
QSet<QModelIndex> 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;
Expand Down
14 changes: 7 additions & 7 deletions pages/pageloganalysis.ui
Original file line number Diff line number Diff line change
Expand Up @@ -568,25 +568,25 @@
</attribute>
<column>
<property name="text">
<string>Y1</string>
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Y2</string>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show this data series on the second Y axis to the right&lt;/p&gt;&lt;p&gt;Y axes will be autoscaled independently&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>Value</string>
</property>
</column>
<column>
<property name="text">
<string>Name</string>
<string>Y1</string>
</property>
</column>
<column>
<property name="text">
<string>Value</string>
<string>Y2</string>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show this data series on the second Y axis to the right&lt;/p&gt;&lt;p&gt;Y axes will be autoscaled independently&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</column>
<column>
Expand Down

0 comments on commit d402aa9

Please sign in to comment.