Skip to content
Snippets Groups Projects
Commit 4367e4a7 authored by Boulongne Corentin's avatar Boulongne Corentin
Browse files

Updated UI, fixed checkboxes not appearing when clicking on refresh button

parent bcc16308
Branches
No related tags found
No related merge requests found
......@@ -55,13 +55,8 @@ public slots:
private slots:
void on_refreshButton_clicked();
void on_pushButton_clicked();
void on_checkBoxClicked(int state);
void on_pushButton_2_clicked();
private:
Ui::GpsMapViewWidget *ui;
......@@ -73,11 +68,7 @@ private:
int mID = -1;
QString markerName_ = "";
double longi = 0.0;
double lati = 0.0;
double ulongi = 0.0;
double ulati = 0.0;
};
......
......@@ -103,6 +103,7 @@ Item {
mID.coordinate.longitude = longitude;
map.addMapItem(mID);
map.update();
}
......
<?xml version="1.0"?>
<package format="2">
<name>rqt_gps_map_view</name>
<version>0.0.1</version>
<version>1.0.0</version>
<description>The rqt_gps_map_view package</description>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
......
......@@ -3,7 +3,7 @@
<description></description>
<qtgui>
<group>
<label>rqt plugins</label>
<label>GPS tracking tools</label>
<icon type="theme">folder</icon>
</group>
<label>GPS Map View</label>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.0, 2022-05-05T17:23:21. -->
<!-- Written by QtCreator 4.11.0, 2022-05-06T11:46:04. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
......
......@@ -111,11 +111,12 @@ void GnssMarker::track()
QVariant latitude_ = latitude;
QVariant longitude_ = longitude;
QVariant randomColor;
if(marker_id != nullptr)
{
QMetaObject::invokeMethod(marker_id, "track", Q_ARG(QVariant, latitude_), Q_ARG(QVariant, longitude_));
QMetaObject::invokeMethod(marker_id, "track", Q_RETURN_ARG(QVariant, randomColor), Q_ARG(QVariant, latitude_), Q_ARG(QVariant, longitude_));
// std::cout << "track function called!" << std::endl;
}
......
......@@ -22,7 +22,7 @@ LICENCE : to define
#include <QQmlContext>
#include <QDebug>
#include <QVector>
#include <QVBoxLayout>
......@@ -76,6 +76,7 @@ void GpsMapViewWidget::updateTopicList()
ui->topicList->clear();
ui->plainTextEdit->clear();
topicsNames.clear();
checkBoxes.clear();
ros::master::V_TopicInfo topics;
ros::master::getTopics(topics);
......@@ -99,18 +100,38 @@ void GpsMapViewWidget::updateTopicList()
}
QVBoxLayout *vbox = new QVBoxLayout(this);
if(topicsNames.isEmpty() == true)
{
QMessageBox msgBox;
msgBox.setWindowTitle("Error while retreiving topics");
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText("It appears that no topics where available, make sure at least one sensor_msgs/NavSatFix topic is being published.");
msgBox.exec();
}else
{
QVBoxLayout *vbox = new QVBoxLayout;
foreach(QString filt, topicsNames){
QCheckBox *checkbox = new QCheckBox(filt, this);
checkBoxes.push_back(checkbox);
checkbox->setChecked(false);
vbox->addWidget(checkbox);
ui->dataSourcesGB->setLayout(vbox);
connect(checkbox, &QCheckBox::stateChanged, this, &GpsMapViewWidget::on_checkBoxClicked);
}
ui->dataSourcesGB->setLayout(vbox);
}
//ui->dataSourcesGB->setLayout(vbox);
}
......@@ -149,8 +170,8 @@ void GpsMapViewWidget::on_checkBoxClicked(int state)
chboxName.replace(QString("/"), QString("_"));
QVariant latitude = ulati;
QVariant longitude = ulongi;
QVariant latitude = 0.0; // create point on center
QVariant longitude = 0.0;
QVariant markerName = chboxName;
markerName_ = "marker"+chboxName;
......@@ -171,11 +192,11 @@ void GpsMapViewWidget::on_checkBoxClicked(int state)
chboxName.replace(QString("/"), QString("_"));
int idx = list.indexOf("marker"+chboxName);
printf("index %d\n", idx);
QVariant indexToRemove = idx;
QMetaObject::invokeMethod(obj, "removeMarker", Q_ARG(QVariant, indexToRemove)); // removing correstponding marker with the topic name
delete gnssMarkerList.at(idx);
gnssMarkerList.removeAt(idx);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment