修正工厂结构,添加航线图表,添加测量

This commit is contained in:
hm
2022-04-06 16:25:17 +08:00
parent 7492424716
commit 85e429ce16
4403 changed files with 2541 additions and 362989 deletions
+34 -17
View File
@@ -3,28 +3,31 @@
namespace mapcontrol {
WayPointButton::WayPointButton(MapGraphicItem *parent) : myMap(parent)
WayPointButton::WayPointButton(MapGraphicItem *parent)
{
this->setAcceptHoverEvents(true);
this->setFlag(QGraphicsItem::ItemIgnoresParentOpacity,true);
this->setFlag(QGraphicsItem::ItemIsMovable, true);
this->setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
this->setFlag(QGraphicsItem::ItemIsSelectable, false);
this->setAcceptedMouseButtons(Qt::LeftButton);
connect(parent, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
connect(parent, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
this->setZValue(8);//在幕布上面
myColor = QColor("#98FB98");
position.setX(0);
position.setY(0);
position.setWidth(100);
position.setHeight(100);
RefreshPos();
}
QRectF WayPointButton::boundingRect() const //鼠标可以操作的大小
@@ -43,29 +46,38 @@ void WayPointButton::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
painter->setRenderHint(QPainter::Antialiasing, true);
QPen ePen;
ePen.setWidth(1);
ePen.setWidth(2);
QFont font;
font.setPixelSize(15);//不随着屏幕分辨率改变而改变
font.setFamily("Arial");//非衬线
font.setFamily("黑体");//非衬线
painter->setFont(font);
//画底部
painter->save();
ePen.setColor(QColor("#2EFE64"));
ePen.setColor(Qt::darkYellow);
painter->setPen(ePen);
painter->setBrush(QColor("#2EFE64"));
painter->setBrush(myColor);
painter->setOpacity(opacity);
painter->drawRoundedRect(0,0,this->boundingRect().width(),this->boundingRect().height(),10,10);
painter->restore();
if(img.size() > 0)
{
painter->save();
QRectF target(0, 0, 80.0, 80.0);
QRectF source(0.0, 0.0, 64.0, 64.0);
QImage image(img);
painter->drawImage(target, image, source);
painter->restore();
}
painter->save();
ePen.setColor(QColor("#000000"));
painter->setPen(ePen);
painter->drawText(0,0,this->boundingRect().width(),this->boundingRect().height(),Qt::AlignCenter,text);
painter->restore();
}
@@ -136,28 +148,36 @@ QString WayPointButton::Text(void)
void WayPointButton::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
event->accept();
qDebug() << "press";
if (event->button() == Qt::LeftButton) {
isDragging = true;
opacity = 1;
emit press();
}
RefreshPos();
update();
}
void WayPointButton::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
event->accept();
qDebug() << "release";
if (event->button() == Qt::LeftButton) {
isDragging = false;
opacity = 0.8;
emit release();
emit clicked();
}
RefreshPos();
update();
}
void WayPointButton::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
event->accept();
qDebug() << "double clicked";
if (event->button() == Qt::LeftButton) {
emit doubleclicked();
}
@@ -173,7 +193,6 @@ void WayPointButton::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void WayPointButton::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
event->accept();
qDebug() << "enter";
opacity = 0.8;
update();
}
@@ -181,7 +200,6 @@ void WayPointButton::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
void WayPointButton::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
event->accept();
qDebug() << "leave";
opacity = 0.5;
update();
}
@@ -189,7 +207,6 @@ void WayPointButton::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
void WayPointButton::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
event->accept();
qDebug() << "move";
}
}