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

Move up/Move down

parent 25d83069
No related branches found
No related tags found
No related merge requests found
...@@ -325,3 +325,36 @@ void MainWindow::on_pbActualToWaypoint_clicked() ...@@ -325,3 +325,36 @@ void MainWindow::on_pbActualToWaypoint_clicked()
setpointList->appendRow(new QStandardItem(str)); setpointList->appendRow(new QStandardItem(str));
} }
void MainWindow::on_pbMoveUp_clicked()
{
if (findChild<QListView *>("setpointList")->currentIndex().isValid()) {
int current = findChild<QListView *>("setpointList")->currentIndex().row();
if (current > 0) {
setpointList->insertRow(current - 1, setpointList->takeItem(current));
}
}
}
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));
}
}
}
void MainWindow::on_pbInsertSetpoint_clicked()
{
int current = 0;
if (findChild<QListView *>("setpointList")->currentIndex().isValid()) {
current = findChild<QListView *>("setpointList")->currentIndex().row();
}
QString str("[" + findChild<QLineEdit *>("xActual")->text() + ", "+
findChild<QLineEdit *>("yActual")->text() + ", " +
findChild<QLineEdit *>("zActual")->text() + "]");
setpointList->insertRow(current, new QStandardItem(str));
}
...@@ -59,6 +59,12 @@ private slots: ...@@ -59,6 +59,12 @@ private slots:
void on_pbActualToWaypoint_clicked(); void on_pbActualToWaypoint_clicked();
void on_pbMoveUp_clicked();
void on_pbMoveDown_clicked();
void on_pbInsertSetpoint_clicked();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
pid_t backendPid; pid_t backendPid;
......
...@@ -660,7 +660,7 @@ ...@@ -660,7 +660,7 @@
<item> <item>
<widget class="QPushButton" name="pbInsertSetpoint"> <widget class="QPushButton" name="pbInsertSetpoint">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Insert</string> <string>Insert</string>
...@@ -719,13 +719,13 @@ ...@@ -719,13 +719,13 @@
<set>QAbstractItemView::NoEditTriggers</set> <set>QAbstractItemView::NoEditTriggers</set>
</property> </property>
<property name="dragEnabled"> <property name="dragEnabled">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="dragDropOverwriteMode"> <property name="dragDropOverwriteMode">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="dragDropMode"> <property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum> <enum>QAbstractItemView::NoDragDrop</enum>
</property> </property>
<property name="defaultDropAction"> <property name="defaultDropAction">
<enum>Qt::MoveAction</enum> <enum>Qt::MoveAction</enum>
...@@ -739,6 +739,24 @@ ...@@ -739,6 +739,24 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="pbMoveUp">
<property name="text">
<string>Move Up</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbMoveDown">
<property name="text">
<string>Move Down</string>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
......
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