1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

GCS - OPMap - create doubleclick signal on the home item

This commit is contained in:
PT_Dreamer 2012-06-20 14:58:33 +01:00
parent 88a089804b
commit 3cf4676aef
2 changed files with 16 additions and 7 deletions

View File

@ -94,17 +94,24 @@ namespace mapcontrol
coord=map->FromLocalToLatLng(this->pos().x(),this->pos().y());
isDragging=false;
emit homePositionChanged(coord);
emit homePositionChanged(coord,Altitude());
}
QGraphicsItem::mouseReleaseEvent(event);
}
void HomeItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
if(event->button()==Qt::LeftButton)
{
emit homedoubleclick(this);
}
}
void HomeItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if(isDragging)
{
coord=map->FromLocalToLatLng(this->pos().x(),this->pos().y());
emit homePositionChanged(coord);
emit homePositionChanged(coord,Altitude());
}
QGraphicsItem::mouseMoveEvent(event);
}

View File

@ -53,10 +53,10 @@ namespace mapcontrol
int SafeArea()const{return safearea;}
void SetSafeArea(int const& value){safearea=value;}
bool safe;
void SetCoord(internals::PointLatLng const& value){emit homePositionChanged(value);coord=value;}
void SetCoord(internals::PointLatLng const& value){coord=value;emit homePositionChanged(value,Altitude());}
internals::PointLatLng Coord()const{return coord;}
void SetAltitude(int const& value){altitude=value;}
int Altitude()const{return altitude;}
void SetAltitude(float const& value){altitude=value;emit homePositionChanged(Coord(),Altitude());}
float Altitude()const{return altitude;}
private:
MapGraphicItem* map;
OPMapWidget* mapwidget;
@ -66,16 +66,18 @@ namespace mapcontrol
bool showsafearea;
int safearea;
int localsafearea;
int altitude;
float altitude;
bool isDragging;
protected:
void mouseMoveEvent ( QGraphicsSceneMouseEvent * event );
void mousePressEvent ( QGraphicsSceneMouseEvent * event );
void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
public slots:
signals:
void homePositionChanged(internals::PointLatLng coord);
void homePositionChanged(internals::PointLatLng coord,float);
void homedoubleclick(HomeItem* waypoint);
};
}
#endif // HOMEITEM_H