From d9335a1e7920c5add7f0b998a87ac81bd48ae7c2 Mon Sep 17 00:00:00 2001 From: Jake <j@kedrahos.com> Date: Fri, 14 Apr 2017 20:38:28 -0500 Subject: [PATCH] Move up/Move down work --- groundStation/gui/MicroCART/mainwindow.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/groundStation/gui/MicroCART/mainwindow.cpp b/groundStation/gui/MicroCART/mainwindow.cpp index 01f6bd1cb..e4916dcbe 100644 --- a/groundStation/gui/MicroCART/mainwindow.cpp +++ b/groundStation/gui/MicroCART/mainwindow.cpp @@ -332,6 +332,7 @@ void MainWindow::on_pbMoveUp_clicked() int current = findChild<QListView *>("setpointList")->currentIndex().row(); if (current > 0) { setpointList->insertRow(current - 1, setpointList->takeItem(current)); + setpointList->removeRow(current + 1); } } } @@ -341,7 +342,8 @@ void MainWindow::on_pbMoveDown_clicked() if (findChild<QListView *>("setpointList")->currentIndex().isValid()) { int current = findChild<QListView *>("setpointList")->currentIndex().row(); 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() current = findChild<QListView *>("setpointList")->currentIndex().row(); } - QString str("[" + findChild<QLineEdit *>("xActual")->text() + ", "+ - findChild<QLineEdit *>("yActual")->text() + ", " + - findChild<QLineEdit *>("zActual")->text() + "]"); + QString str("[" + findChild<QLineEdit *>("xSetpoint")->text() + ", "+ + findChild<QLineEdit *>("ySetpoint")->text() + ", " + + findChild<QLineEdit *>("zSetpoint")->text() + "]"); setpointList->insertRow(current, new QStandardItem(str)); } -- GitLab