#ifndef WAYPOINTBUTTON_H #define WAYPOINTBUTTON_H #include #include #include #include "pointlatlng.h" #include "mapgraphicitem.h" #include "waypointitem.h" #include #include #include namespace mapcontrol { //class OPMapWidget; #ifdef QtopmapWidget #include class OPMAPWIDGETSHARED_EXPORT WayPointButton : public QObject, public QGraphicsItem { #else class WayPointButton : public QObject, public QGraphicsItem { #endif Q_OBJECT Q_INTERFACES(QGraphicsItem) public: enum { Type = UserType + 25 }; WayPointButton(MapGraphicItem *parent = nullptr); QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); private: MapGraphicItem *myMap; QColor myColor; QString img; bool isDragging; qreal opacity = 0.5; QRect position; QString text; bool highlight = false; signals: void doubleclicked(void); void clicked(void); void press(void); void release(void); protected: void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void hoverEnterEvent(QGraphicsSceneHoverEvent *event); void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); void hoverMoveEvent(QGraphicsSceneHoverEvent *event); public slots: void setPosition(int x,int y); void resize(int width,int height); void setGeometry(QRect rect); void setGeometry(int x,int y,int w,int h); void RefreshPos(); void setOpacitySlot(qreal opacity); void setHighLight(bool flag); bool HighLight(void) { return highlight; } void setText(QString t); QString Text(void); }; } //NAME SPACE #endif // WAYPOINTBUTTON_H