Commit aef36099 authored by Michael Carpenter's avatar Michael Carpenter

Fix for crash when removing item from QuickView, and addition of more generic...

Fix for crash when removing item from QuickView, and addition of more generic signal/slot combonation for property updates
parent 73a9b95c
......@@ -118,6 +118,7 @@ public:
{
localX = val;
emit localXChanged(val,"localX");
emit valueChanged(this->uasId,"localX","M",QVariant(val),getUnixTime());
}
double getLocalX() const
{
......@@ -128,6 +129,7 @@ public:
{
localY = val;
emit localYChanged(val,"localY");
emit valueChanged(this->uasId,"localY","M",QVariant(val),getUnixTime());
}
double getLocalY() const
{
......@@ -138,6 +140,7 @@ public:
{
localZ = val;
emit localZChanged(val,"localZ");
emit valueChanged(this->uasId,"localZ","M",QVariant(val),getUnixTime());
}
double getLocalZ() const
{
......@@ -148,6 +151,7 @@ public:
{
latitude = val;
emit latitudeChanged(val,"latitude");
emit valueChanged(this->uasId,"latitude","deg",QVariant(val),getUnixTime());
}
double getLatitude() const
{
......@@ -158,6 +162,7 @@ public:
{
longitude = val;
emit longitudeChanged(val,"longitude");
emit valueChanged(this->uasId,"longitude","deg",QVariant(val),getUnixTime());
}
double getLongitude() const
{
......@@ -168,6 +173,7 @@ public:
{
altitude = val;
emit altitudeChanged(val,"altitude");
emit valueChanged(this->uasId,"altitude","M",QVariant(val),getUnixTime());
}
double getAltitude() const
......@@ -179,6 +185,7 @@ public:
{
satelliteCount = val;
emit satelliteCountChanged(val,"satelliteCount");
emit valueChanged(this->uasId,"satelliteCount","M",QVariant(val),getUnixTime());
}
double getSatelliteCount() const
......@@ -199,6 +206,7 @@ public:
{
distToWaypoint = val;
emit distToWaypointChanged(val,"distToWaypoint");
emit valueChanged(this->uasId,"distToWaypoint","M",QVariant(val),getUnixTime());
}
double getDistToWaypoint() const
......@@ -807,6 +815,8 @@ signals:
void satelliteCountChanged(double val,QString name);
void distToWaypointChanged(double val,QString name);
protected:
/** @brief Get the UNIX timestamp in milliseconds, enter microseconds */
quint64 getUnixTime(quint64 time=0);
......
......@@ -449,6 +449,7 @@ signals:
void valueChanged(const int uasId, const QString& name, const QString& unit, const quint64 value, const quint64 msec);
void valueChanged(const int uasId, const QString& name, const QString& unit, const qint64 value, const quint64 msec);
void valueChanged(const int uasId, const QString& name, const QString& unit, const double value, const quint64 msec);
void valueChanged(const int uasid, const QString& name, const QString& unit, const QVariant value,const quint64 msecs);
void voltageChanged(int uasId, double voltage);
void waypointUpdated(int uasId, int id, double x, double y, double z, double yaw, bool autocontinue, bool active);
......
......@@ -106,6 +106,7 @@ void UASQuickView::setActiveUAS(UASInterface* uas)
return;
}
this->uas = uas;
connect(uas,SIGNAL(valueChanged(int,QString,QString,QVariant,quint64)),this,SLOT(valueChanged(int,QString,QString,QVariant,quint64)));
uasPropertyList.clear();
qDebug() << "UASInfoWidget property count:" << uas->metaObject()->propertyCount();
for (int i=0;i<uas->metaObject()->propertyCount();i++)
......@@ -151,13 +152,18 @@ void UASQuickView::actionTriggered(bool checked)
else
{
ui.verticalLayout->removeWidget(uasPropertyToLabelMap[senderlabel->text()]);
uasPropertyToLabelMap.remove(senderlabel->text());
uasPropertyToLabelMap[senderlabel->text()]->deleteLater();
uasPropertyToLabelMap.remove(senderlabel->text());
}
}
void UASQuickView::valueChanged(const int uasid, const QString& name, const QString& unit, const QVariant value,const quint64 msecs)
{
uasPropertyValueMap[name] = value.toDouble();
}
void UASQuickView::valChanged(double val,QString type)
{
//qDebug() << "Value changed:" << type << val;
uasPropertyValueMap[type] = val;
// uasPropertyValueMap[type] = val;
}
......@@ -24,6 +24,7 @@ protected:
signals:
public slots:
void valueChanged(const int uasid, const QString& name, const QString& unit, const QVariant value,const quint64 msecs);
void actionTriggered(bool checked);
void updateTimerTick();
void addUAS(UASInterface* uas);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment