1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

Reenabled double-clicking on Home to set lat/lon/altitude.

Also reduced the size of the double-click sensitive area.
This commit is contained in:
Laura Sebesta 2012-09-27 23:45:02 +02:00 committed by Kenz Dale
parent 98176d9829
commit db15b01e35
2 changed files with 11 additions and 1 deletions

View File

@ -34,7 +34,7 @@ namespace mapcontrol
pic=pic.scaled(30,30,Qt::IgnoreAspectRatio); pic=pic.scaled(30,30,Qt::IgnoreAspectRatio);
this->setFlag(QGraphicsItem::ItemIgnoresTransformations,true); this->setFlag(QGraphicsItem::ItemIgnoresTransformations,true);
this->setFlag(QGraphicsItem::ItemIsMovable,false); this->setFlag(QGraphicsItem::ItemIsMovable,false);
this->setFlag(QGraphicsItem::ItemIsSelectable,false); this->setFlag(QGraphicsItem::ItemIsSelectable,true);
localposition=map->FromLatLngToLocal(mapwidget->CurrentPosition()); localposition=map->FromLatLngToLocal(mapwidget->CurrentPosition());
this->setPos(localposition.X(),localposition.Y()); this->setPos(localposition.X(),localposition.Y());
this->setZValue(4); this->setZValue(4);
@ -142,5 +142,14 @@ namespace mapcontrol
} }
QGraphicsItem::mouseMoveEvent(event); QGraphicsItem::mouseMoveEvent(event);
} }
//Set clickable area as smaller than the bounding rect.
QPainterPath HomeItem::shape() const
{
QPainterPath path;
path.addEllipse(QRectF(-12, -25, 24, 50));
return path;
}
} }

View File

@ -76,6 +76,7 @@ namespace mapcontrol
void mousePressEvent ( QGraphicsSceneMouseEvent * event ); void mousePressEvent ( QGraphicsSceneMouseEvent * event );
void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
QPainterPath shape() const;
public slots: public slots:
void RefreshPos(); void RefreshPos();
void setOpacitySlot(qreal opacity); void setOpacitySlot(qreal opacity);