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"
|
#include "areaitem.h"
|
||||||
|
|
||||||
|
|
||||||
ToolTip AreaItem::toolTip() const
|
QString AreaItem::info() const
|
||||||
{
|
{
|
||||||
ToolTip tt;
|
ToolTip tt;
|
||||||
|
|
||||||
@ -18,11 +18,11 @@ ToolTip AreaItem::toolTip() const
|
|||||||
tt.insert(qApp->translate("PolygonItem", "Description"),
|
tt.insert(qApp->translate("PolygonItem", "Description"),
|
||||||
_area.description());
|
_area.description());
|
||||||
|
|
||||||
return tt;
|
return tt.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
AreaItem::AreaItem(const Area &area, Map *map, QGraphicsItem *parent)
|
AreaItem::AreaItem(const Area &area, Map *map, GraphicsItem *parent)
|
||||||
: QGraphicsItem(parent), _area(area)
|
: GraphicsItem(parent), _area(area)
|
||||||
{
|
{
|
||||||
_map = map;
|
_map = map;
|
||||||
_digitalZoom = 0;
|
_digitalZoom = 0;
|
||||||
@ -173,6 +173,6 @@ void AreaItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
|
|
||||||
void AreaItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
void AreaItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
Popup::show(event->screenPos(), toolTip().toString(), event->widget());
|
Popup::show(event->screenPos(), info(), event->widget());
|
||||||
QGraphicsItem::mousePressEvent(event);
|
QGraphicsItem::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
#ifndef AREAITEM_H
|
#ifndef AREAITEM_H
|
||||||
#define AREAITEM_H
|
#define AREAITEM_H
|
||||||
|
|
||||||
#include <QGraphicsItem>
|
|
||||||
#include "data/area.h"
|
#include "data/area.h"
|
||||||
|
#include "graphicsscene.h"
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
|
|
||||||
class Map;
|
class Map;
|
||||||
|
|
||||||
class AreaItem : public QGraphicsItem
|
class AreaItem : public GraphicsItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AreaItem(const Area &area, Map *map, QGraphicsItem *parent = 0);
|
AreaItem(const Area &area, Map *map, GraphicsItem *parent = 0);
|
||||||
|
|
||||||
QPainterPath shape() const {return _painterPath;}
|
QPainterPath shape() const {return _painterPath;}
|
||||||
QRectF boundingRect() const {return _painterPath.boundingRect();}
|
QRectF boundingRect() const {return _painterPath.boundingRect();}
|
||||||
@ -27,6 +27,8 @@ public:
|
|||||||
void setStyle(Qt::PenStyle style);
|
void setStyle(Qt::PenStyle style);
|
||||||
void setDigitalZoom(int zoom);
|
void setDigitalZoom(int zoom);
|
||||||
|
|
||||||
|
virtual QString info() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||||
|
Loading…
Reference in New Issue
Block a user