修改航线显示,选中的要显示在顶层,未选中的显示在底层

This commit is contained in:
hm
2022-07-15 11:03:29 +08:00
parent a4b905e806
commit adf77ef3f6
2 changed files with 48 additions and 9 deletions
+43 -7
View File
@@ -72,7 +72,7 @@ WayPointItem::WayPointItem(const internals::PointLatLng &coord, int const & alti
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
this->setZValue(5);
this->setZValue(4);
}
@@ -122,7 +122,7 @@ WayPointItem::WayPointItem(int seq,int missiontype, MapGraphicItem *map, bool ma
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
this->setZValue(5);
this->setZValue(4);
}
WayPointItem::WayPointItem(const internals::PointLatLng &coord, int const & altitude,int seq, int missiontype, const QString &description, MapGraphicItem *map, wptype type) : coord(coord), reached(false), description(description), shownumber(true), isDragging(false), altitude(altitude), map(map), myType(type)
{
@@ -162,7 +162,7 @@ WayPointItem::WayPointItem(const internals::PointLatLng &coord, int const & alti
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
this->setZValue(5);
this->setZValue(4);
}
WayPointItem::WayPointItem(const distBearingAltitude &relativeCoordenate,int seq,int missiontype, const QString &description, MapGraphicItem *map) : relativeCoord(relativeCoordenate), reached(false), description(description), shownumber(true), isDragging(false), map(map)
@@ -202,7 +202,7 @@ WayPointItem::WayPointItem(const distBearingAltitude &relativeCoordenate,int seq
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
this->setZValue(5);
this->setZValue(4);
}
void WayPointItem::setWPType(wptype type)
@@ -226,6 +226,36 @@ void WayPointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
Q_UNUSED(option);
Q_UNUSED(widget);
/*
if(isactive == true)//激活才有颜色,否则是灰色
{
if(isEdit == true)
{
if (this->isSelected()) {
this->setZValue(6);
}
else
{
this->setZValue(5);
}
}
else
{
this->setZValue(5);
}
}
else//没有激活是灰色
{
if (Command() < MAV_CMD::MAV_CMD_NAV_LAST) {
this->setZValue(2);
}
else
{
this->setZValue(2);
}
}
if(isEdit == true)
{
if (this->isSelected()) {
@@ -239,13 +269,14 @@ void WayPointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
else
{
if (Command() < MAV_CMD::MAV_CMD_NAV_LAST) {
this->setZValue(6);
this->setZValue(2);
}
else
{
this->setZValue(5);
this->setZValue(2);
}
}
*/
@@ -273,6 +304,7 @@ void WayPointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
if (this->isSelected()) {//被选中才能是绿色
ePen.setColor(QColor("#008B00"));
painter->setBrush(QColor("#008B00"));
this->setZValue(6);
}
else {
@@ -286,6 +318,8 @@ void WayPointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
ePen.setColor(QColor("#8B4500"));
painter->setBrush(QColor("#8B4500"));
}
this->setZValue(5);
}
}
else//飞行界面
@@ -293,6 +327,7 @@ void WayPointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
if (isCurrent) {//选择作为当前才能显示绿色
ePen.setColor(QColor("#008B00"));
painter->setBrush(QColor("#008B00"));
this->setZValue(6);
}
else {
@@ -306,7 +341,7 @@ void WayPointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
ePen.setColor(QColor("#8B4500"));
painter->setBrush(QColor("#8B4500"));
}
this->setZValue(5);
}
}
}
@@ -314,6 +349,7 @@ void WayPointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
{
ePen.setColor(QColor("#787878"));
painter->setBrush(QColor("#787878"));
this->setZValue(2);
}
+5 -2
View File
@@ -90,18 +90,21 @@ void WayPointLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
if(isactive == true)//激活才有颜色,否则是灰色
{
if(isEdit == false)
if(isEdit == true)
{
myPen.setColor(myColor);
setZValue(4);
}
else
{
//myPen.setColor("#ffff00");
myPen.setColor(myColor);
setZValue(4);
}
}
else//没有激活是灰色
{
setZValue(1);
myPen.setColor(QColor("#787878"));
painter->setBrush(QColor("#787878"));
}