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

Move up/Move down work

parent 6905759c
No related branches found
No related tags found
No related merge requests found
...@@ -332,6 +332,7 @@ void MainWindow::on_pbMoveUp_clicked() ...@@ -332,6 +332,7 @@ void MainWindow::on_pbMoveUp_clicked()
int current = findChild<QListView *>("setpointList")->currentIndex().row(); int current = findChild<QListView *>("setpointList")->currentIndex().row();
if (current > 0) { if (current > 0) {
setpointList->insertRow(current - 1, setpointList->takeItem(current)); setpointList->insertRow(current - 1, setpointList->takeItem(current));
setpointList->removeRow(current + 1);
} }
} }
} }
...@@ -341,7 +342,8 @@ void MainWindow::on_pbMoveDown_clicked() ...@@ -341,7 +342,8 @@ void MainWindow::on_pbMoveDown_clicked()
if (findChild<QListView *>("setpointList")->currentIndex().isValid()) { if (findChild<QListView *>("setpointList")->currentIndex().isValid()) {
int current = findChild<QListView *>("setpointList")->currentIndex().row(); int current = findChild<QListView *>("setpointList")->currentIndex().row();
if (current < (setpointList->rowCount() - 1)) { if (current < (setpointList->rowCount() - 1)) {
setpointList->insertRow(current - 1, setpointList->takeItem(current)); setpointList->insertRow(current + 2, setpointList->takeItem(current));
setpointList->removeRow(current);
} }
} }
} }
...@@ -353,8 +355,8 @@ void MainWindow::on_pbInsertSetpoint_clicked() ...@@ -353,8 +355,8 @@ void MainWindow::on_pbInsertSetpoint_clicked()
current = findChild<QListView *>("setpointList")->currentIndex().row(); current = findChild<QListView *>("setpointList")->currentIndex().row();
} }
QString str("[" + findChild<QLineEdit *>("xActual")->text() + ", "+ QString str("[" + findChild<QLineEdit *>("xSetpoint")->text() + ", "+
findChild<QLineEdit *>("yActual")->text() + ", " + findChild<QLineEdit *>("ySetpoint")->text() + ", " +
findChild<QLineEdit *>("zActual")->text() + "]"); findChild<QLineEdit *>("zSetpoint")->text() + "]");
setpointList->insertRow(current, new QStandardItem(str)); setpointList->insertRow(current, new QStandardItem(str));
} }
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