mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-24 09:52:11 +01:00
OP-1071 Adds dashed and width functionality to circle.
This commit is contained in:
parent
e8dca2d089
commit
4aad52f6f7
@ -41,7 +41,7 @@ WayPointCircle::WayPointCircle(WayPointItem *center, WayPointItem *radius, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
WayPointCircle::WayPointCircle(HomeItem *radius, WayPointItem *center, bool clockwise, MapGraphicItem *map, QColor color, bool dashed, int width) : my_center(center),
|
WayPointCircle::WayPointCircle(HomeItem *radius, WayPointItem *center, bool clockwise, MapGraphicItem *map, QColor color, bool dashed, int width) : my_center(center),
|
||||||
my_radius(radius), my_map(map), QGraphicsEllipseItem(map), myColor(color), myClockWise(clockwise)
|
my_radius(radius), my_map(map), QGraphicsEllipseItem(map), myColor(color), myClockWise(clockwise), dashed(dashed), width(width)
|
||||||
{
|
{
|
||||||
connect(radius, SIGNAL(homePositionChanged(internals::PointLatLng, float)), this, SLOT(refreshLocations()));
|
connect(radius, SIGNAL(homePositionChanged(internals::PointLatLng, float)), this, SLOT(refreshLocations()));
|
||||||
connect(center, SIGNAL(localPositionChanged(QPointF)), this, SLOT(refreshLocations()));
|
connect(center, SIGNAL(localPositionChanged(QPointF)), this, SLOT(refreshLocations()));
|
||||||
@ -67,6 +67,14 @@ void WayPointCircle::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
|
|||||||
p2 = QPointF(line.p1().x(), line.p1().y() - line.length());
|
p2 = QPointF(line.p1().x(), line.p1().y() - line.length());
|
||||||
QPen myPen = pen();
|
QPen myPen = pen();
|
||||||
myPen.setColor(myColor);
|
myPen.setColor(myColor);
|
||||||
|
if(width > 0) {
|
||||||
|
myPen.setWidth(width);
|
||||||
|
}
|
||||||
|
if(dashed){
|
||||||
|
QVector<qreal> dashes;
|
||||||
|
dashes << 4 << 8;
|
||||||
|
myPen.setDashPattern(dashes);
|
||||||
|
}
|
||||||
qreal arrowSize = 10;
|
qreal arrowSize = 10;
|
||||||
painter->setPen(myPen);
|
painter->setPen(myPen);
|
||||||
QBrush brush = painter->brush();
|
QBrush brush = painter->brush();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user