Fix incorrect sensor selection due to reorder sensors in SensorListWidget

This commit is contained in:
Carl Philipp Klemm 2025-10-05 23:29:23 +02:00
parent 271330d5fd
commit 0c5603ca44
7 changed files with 47 additions and 15 deletions

View file

@ -46,5 +46,5 @@ void PolynomalActorWidget::setPow()
void PolynomalActorWidget::setSensor(const QModelIndex &index)
{
actor_->setSensor(sensors_->getSensors()->at(index.row()));
actor_->setSensor(ui->listView->getSensorForIndex(index));
}

View file

@ -47,7 +47,7 @@ void RegulatorWdiget::setBand(double band)
void RegulatorWdiget::setSensor(const QModelIndex &index)
{
regulator_->setSensor(sensors_->getSensors()->at(index.row()));
regulator_->setSensor(ui->listView->getSensorForIndex(index));
setPoint(sensors_->getSensors()->at(index.row()).field);
ui->doubleSpinBox_setPoint->setValue(sensors_->getSensors()->at(index.row()).field);
}

View file

@ -17,9 +17,12 @@ SensorActorWidget::SensorActorWidget(std::shared_ptr<SensorActor> sensorActor, S
ui->label->hide();
}
if(sensorActor_->getSloap() == SensorActor::SLOPE_UP) ui->comboBox_slope->setCurrentIndex(0);
else if(sensorActor_->getSloap() == SensorActor::SLOPE_DOWN) ui->comboBox_slope->setCurrentIndex(1);
else if(sensorActor_->getSloap() == SensorActor::SLOPE_BOTH) ui->comboBox_slope->setCurrentIndex(2);
if(sensorActor_->getSloap() == SensorActor::SLOPE_UP)
ui->comboBox_slope->setCurrentIndex(0);
else if(sensorActor_->getSloap() == SensorActor::SLOPE_DOWN)
ui->comboBox_slope->setCurrentIndex(1);
else if(sensorActor_->getSloap() == SensorActor::SLOPE_BOTH)
ui->comboBox_slope->setCurrentIndex(2);
ui->doubleSpinBox_threshold->setValue(sensorActor_->getThreshold());
@ -47,6 +50,5 @@ void SensorActorWidget::setSlope(int index)
void SensorActorWidget::setSensor(const QModelIndex &index)
{
sensorActor_->setSensor(sensors_->getSensors()->at(index.row()));
qDebug()<<"Selected "<<sensors_->getSensors()->at(index.row()).name;
sensorActor_->setSensor(ui->listView->getSensorForIndex(index));
}