mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Fixed areas tooltip handling
This commit is contained in:
parent
db7e60bdfb
commit
65e04ce08b
@ -8,7 +8,7 @@
|
||||
#include "areaitem.h"
|
||||
|
||||
|
||||
ToolTip AreaItem::toolTip() const
|
||||
QString AreaItem::info() const
|
||||
{
|
||||
ToolTip tt;
|
||||
|
||||
@ -18,11 +18,11 @@ ToolTip AreaItem::toolTip() const
|
||||
tt.insert(qApp->translate("PolygonItem", "Description"),
|
||||
_area.description());
|
||||
|
||||
return tt;
|
||||
return tt.toString();
|
||||
}
|
||||
|
||||
AreaItem::AreaItem(const Area &area, Map *map, QGraphicsItem *parent)
|
||||
: QGraphicsItem(parent), _area(area)
|
||||
AreaItem::AreaItem(const Area &area, Map *map, GraphicsItem *parent)
|
||||
: GraphicsItem(parent), _area(area)
|
||||
{
|
||||
_map = map;
|
||||
_digitalZoom = 0;
|
||||
@ -173,6 +173,6 @@ void AreaItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
|
||||
void AreaItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
Popup::show(event->screenPos(), toolTip().toString(), event->widget());
|
||||
Popup::show(event->screenPos(), info(), event->widget());
|
||||
QGraphicsItem::mousePressEvent(event);
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
#ifndef AREAITEM_H
|
||||
#define AREAITEM_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include "data/area.h"
|
||||
#include "graphicsscene.h"
|
||||
#include "tooltip.h"
|
||||
|
||||
class Map;
|
||||
|
||||
class AreaItem : public QGraphicsItem
|
||||
class AreaItem : public GraphicsItem
|
||||
{
|
||||
public:
|
||||
AreaItem(const Area &area, Map *map, QGraphicsItem *parent = 0);
|
||||
AreaItem(const Area &area, Map *map, GraphicsItem *parent = 0);
|
||||
|
||||
QPainterPath shape() const {return _painterPath;}
|
||||
QRectF boundingRect() const {return _painterPath.boundingRect();}
|
||||
@ -27,6 +27,8 @@ public:
|
||||
void setStyle(Qt::PenStyle style);
|
||||
void setDigitalZoom(int zoom);
|
||||
|
||||
virtual QString info() const;
|
||||
|
||||
protected:
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||
|
Loading…
Reference in New Issue
Block a user