Skip to content
Snippets Groups Projects
Commit d824b14f authored by Jake's avatar Jake
Browse files

Added smarts to setpoint choosers

Now they do a good job of defaulting to the right setpoints
parent d3e3e6a1
No related branches found
No related tags found
No related merge requests found
...@@ -143,17 +143,31 @@ void MainWindow::newNodes(QStringList blocks) ...@@ -143,17 +143,31 @@ void MainWindow::newNodes(QStringList blocks)
void MainWindow::newConstantBlocks(QStringList blocks) void MainWindow::newConstantBlocks(QStringList blocks)
{ {
QComboBox * select = findChild<QComboBox *>("xSetpointSelect"); QComboBox * xSelect = findChild<QComboBox *>("xSetpointSelect");
select->clear(); /* Hopefully this clears the list */ xSelect->clear(); /* Hopefully this clears the list */
select->addItems(blocks); xSelect->addItems(blocks);
select = findChild<QComboBox *>("ySetpointSelect"); QComboBox * ySelect = findChild<QComboBox *>("ySetpointSelect");
select->clear(); /* Hopefully this clears the list */ ySelect->clear(); /* Hopefully this clears the list */
select->addItems(blocks); ySelect->addItems(blocks);
select = findChild<QComboBox *>("zSetpointSelect"); QComboBox * zSelect = findChild<QComboBox *>("zSetpointSelect");
select->clear(); /* Hopefully this clears the list */ zSelect->clear(); /* Hopefully this clears the list */
select->addItems(blocks); zSelect->addItems(blocks);
for (ssize_t i = 0; i < blocks.size(); i++) {
if (blocks[i].contains("setpoint", Qt::CaseInsensitive) || blocks[i].contains("sp", Qt::CaseInsensitive)) {
if (blocks[i].contains("x ", Qt::CaseInsensitive)) {
xSelect->setCurrentIndex(i);
}
if (blocks[i].contains("y ", Qt::CaseInsensitive)) {
ySelect->setCurrentIndex(i);
}
if (blocks[i].contains("z ", Qt::CaseInsensitive) || blocks[i].contains("alt", Qt::CaseInsensitive)) {
zSelect->setCurrentIndex(i);
}
}
}
} }
void MainWindow::newParams(QStringList params) void MainWindow::newParams(QStringList params)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment