mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-07 18:53:02 +02:00
Compare commits
3 Commits
466c538e17
...
c23c4470a7
Author | SHA1 | Date | |
---|---|---|---|
c23c4470a7 | |||
73a60f5046 | |||
1466de5ddf |
@ -23,6 +23,7 @@ greaterThan(QT_MAJOR_VERSION, 5) {
|
|||||||
CONFIG += object_parallel_to_source
|
CONFIG += object_parallel_to_source
|
||||||
INCLUDEPATH += ./src
|
INCLUDEPATH += ./src
|
||||||
HEADERS += src/common/config.h \
|
HEADERS += src/common/config.h \
|
||||||
|
src/GUI/legendentryitem.h \
|
||||||
src/GUI/legenditem.h \
|
src/GUI/legenditem.h \
|
||||||
src/common/garmin.h \
|
src/common/garmin.h \
|
||||||
src/common/coordinates.h \
|
src/common/coordinates.h \
|
||||||
@ -277,6 +278,7 @@ HEADERS += src/common/config.h \
|
|||||||
src/data/geojsonparser.h
|
src/data/geojsonparser.h
|
||||||
|
|
||||||
SOURCES += src/main.cpp \
|
SOURCES += src/main.cpp \
|
||||||
|
src/GUI/legendentryitem.cpp \
|
||||||
src/GUI/legenditem.cpp \
|
src/GUI/legenditem.cpp \
|
||||||
src/common/coordinates.cpp \
|
src/common/coordinates.cpp \
|
||||||
src/common/rectc.cpp \
|
src/common/rectc.cpp \
|
||||||
|
@ -178,6 +178,16 @@ void AreaItem::setDigitalZoom(int zoom)
|
|||||||
_pen.setWidthF(width() * pow(2, -_digitalZoom));
|
_pen.setWidthF(width() * pow(2, -_digitalZoom));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AreaItem::hover(bool hvr)
|
||||||
|
{
|
||||||
|
if (hvr)
|
||||||
|
_pen.setWidthF((_width + 1) * pow(2, -_digitalZoom));
|
||||||
|
else
|
||||||
|
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
void AreaItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
void AreaItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
class AreaItem : public PlaneItem
|
class AreaItem : public PlaneItem
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AreaItem(const Area &area, Map *map, GraphicsItem *parent = 0);
|
AreaItem(const Area &area, Map *map, GraphicsItem *parent = 0);
|
||||||
|
|
||||||
@ -31,6 +33,9 @@ public:
|
|||||||
const QColor color() const {return _pen.color();}
|
const QColor color() const {return _pen.color();}
|
||||||
const QString &name() const {return _area.name();}
|
const QString &name() const {return _area.name();}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void hover(bool hvr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||||
|
72
src/GUI/legendentryitem.cpp
Normal file
72
src/GUI/legendentryitem.cpp
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#include <QPainter>
|
||||||
|
#include <QCursor>
|
||||||
|
#include "font.h"
|
||||||
|
#include "legendentryitem.h"
|
||||||
|
|
||||||
|
#define PADDING 2
|
||||||
|
|
||||||
|
LegendEntryItem::LegendEntryItem(const QColor &color, const QString &text,
|
||||||
|
QGraphicsItem *parent) : QGraphicsItem(parent), _color(color), _text(text)
|
||||||
|
{
|
||||||
|
_textColor = Qt::black;
|
||||||
|
_font.setPixelSize(FONT_SIZE);
|
||||||
|
_font.setFamily(FONT_FAMILY);
|
||||||
|
|
||||||
|
QFontMetrics fm(_font);
|
||||||
|
_boundingRect = QRectF(0, 0, FONT_SIZE * 2 + PADDING * 2
|
||||||
|
+ fm.tightBoundingRect(text).width() + PADDING * 2,
|
||||||
|
FONT_SIZE + PADDING * 2);
|
||||||
|
|
||||||
|
setCursor(Qt::ArrowCursor);
|
||||||
|
setAcceptHoverEvents(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LegendEntryItem::paint(QPainter *painter,
|
||||||
|
const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
Q_UNUSED(option);
|
||||||
|
Q_UNUSED(widget);
|
||||||
|
QFontMetrics fm(_font);
|
||||||
|
|
||||||
|
painter->setRenderHint(QPainter::Antialiasing, false);
|
||||||
|
|
||||||
|
painter->setFont(_font);
|
||||||
|
painter->setBrush(_color);
|
||||||
|
painter->setPen(QPen(Qt::black));
|
||||||
|
painter->drawRect(PADDING, PADDING, FONT_SIZE * 2, FONT_SIZE);
|
||||||
|
painter->setPen(QPen(_textColor));
|
||||||
|
painter->drawText(FONT_SIZE * 2 + PADDING * 2 + PADDING,
|
||||||
|
PADDING + fm.ascent(), _text);
|
||||||
|
|
||||||
|
//painter->setPen(Qt::red);
|
||||||
|
//painter->setBrush(Qt::NoBrush);
|
||||||
|
//painter->drawRect(boundingRect());
|
||||||
|
}
|
||||||
|
|
||||||
|
void LegendEntryItem::setTextColor(const QColor &color)
|
||||||
|
{
|
||||||
|
_textColor = color;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LegendEntryItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
|
{
|
||||||
|
Q_UNUSED(event);
|
||||||
|
|
||||||
|
_font.setBold(true);
|
||||||
|
setZValue(zValue() + 1.0);
|
||||||
|
update();
|
||||||
|
|
||||||
|
emit selected(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LegendEntryItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
|
{
|
||||||
|
Q_UNUSED(event);
|
||||||
|
|
||||||
|
_font.setBold(false);
|
||||||
|
setZValue(zValue() - 1.0);
|
||||||
|
update();
|
||||||
|
|
||||||
|
emit selected(false);
|
||||||
|
}
|
36
src/GUI/legendentryitem.h
Normal file
36
src/GUI/legendentryitem.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#ifndef LEGENDENTRYITEM_H
|
||||||
|
#define LEGENDENTRYITEM_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QGraphicsItem>
|
||||||
|
#include <QFont>
|
||||||
|
|
||||||
|
class LegendEntryItem : public QObject, public QGraphicsItem
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(QGraphicsItem)
|
||||||
|
|
||||||
|
public:
|
||||||
|
LegendEntryItem(const QColor &color, const QString &text,
|
||||||
|
QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
|
QRectF boundingRect() const {return _boundingRect;}
|
||||||
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget);
|
||||||
|
|
||||||
|
void setTextColor(const QColor &color);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void selected(bool);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||||
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||||
|
|
||||||
|
QRectF _boundingRect;
|
||||||
|
QColor _color, _textColor;
|
||||||
|
QString _text;
|
||||||
|
QFont _font;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LEGENDENTRYITEM_H
|
@ -1,17 +1,17 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QFileInfo>
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
#include "pathitem.h"
|
||||||
|
#include "graphitem.h"
|
||||||
|
#include "planeitem.h"
|
||||||
|
#include "legendentryitem.h"
|
||||||
#include "legenditem.h"
|
#include "legenditem.h"
|
||||||
|
|
||||||
#define PADDING 4
|
|
||||||
|
|
||||||
LegendItem::LegendItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
LegendItem::LegendItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||||
{
|
{
|
||||||
_color = Qt::black;
|
|
||||||
_bgColor = Qt::white;
|
_bgColor = Qt::white;
|
||||||
_drawBackground = false;
|
_drawBackground = false;
|
||||||
_font.setPixelSize(FONT_SIZE);
|
|
||||||
_font.setFamily(FONT_FAMILY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LegendItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
void LegendItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
@ -28,21 +28,6 @@ void LegendItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
|||||||
bc.setAlpha(196);
|
bc.setAlpha(196);
|
||||||
painter->setBrush(QBrush(bc));
|
painter->setBrush(QBrush(bc));
|
||||||
painter->drawRect(_boundingRect);
|
painter->drawRect(_boundingRect);
|
||||||
painter->setBrush(Qt::NoBrush);
|
|
||||||
}
|
|
||||||
|
|
||||||
QFontMetrics fm(_font);
|
|
||||||
painter->setFont(_font);
|
|
||||||
|
|
||||||
for (int i = 0; i < _items.size(); i++) {
|
|
||||||
const Item &itm = _items.at(i);
|
|
||||||
|
|
||||||
painter->setBrush(itm.color);
|
|
||||||
painter->setPen(QPen(Qt::black));
|
|
||||||
painter->drawRect(0, i * (FONT_SIZE + PADDING), FONT_SIZE * 2, FONT_SIZE);
|
|
||||||
painter->setPen(QPen(_color));
|
|
||||||
painter->drawText(FONT_SIZE * 2 + PADDING, i * (FONT_SIZE + PADDING)
|
|
||||||
+ fm.ascent(), itm.text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//painter->setPen(Qt::red);
|
//painter->setPen(Qt::red);
|
||||||
@ -50,23 +35,45 @@ void LegendItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
|||||||
//painter->drawRect(boundingRect());
|
//painter->drawRect(boundingRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LegendItem::addItem(const QColor &color, const QString &text)
|
void LegendItem::addItem(PathItem *item)
|
||||||
{
|
{
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
|
|
||||||
_items.append(Item(color, text));
|
LegendEntryItem *li = new LegendEntryItem(item->color(),
|
||||||
|
item->name().isEmpty() ? QFileInfo(item->file()).fileName() : item->name(),
|
||||||
|
this);
|
||||||
|
li->setPos(0, _items.size() * li->boundingRect().height());
|
||||||
|
|
||||||
QFontMetrics fm(_font);
|
_items.append(li);
|
||||||
qreal maxWidth = qMax((int)_boundingRect.width() - (FONT_SIZE * 2 + PADDING),
|
|
||||||
fm.tightBoundingRect(text).width());
|
_boundingRect = QRectF(0, 0, qMax(_boundingRect.width(),
|
||||||
_boundingRect = QRectF(0, 0, FONT_SIZE * 2 + PADDING + maxWidth,
|
li->boundingRect().width()), _items.size() * li->boundingRect().height());
|
||||||
_items.size() * (FONT_SIZE + PADDING) - (PADDING - 1));
|
|
||||||
|
QObject::connect(li, &LegendEntryItem::selected, item, &PathItem::hoverAll);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LegendItem::addItem(PlaneItem *item)
|
||||||
|
{
|
||||||
|
if (item->name().isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
prepareGeometryChange();
|
||||||
|
|
||||||
|
LegendEntryItem *li = new LegendEntryItem(item->color(), item->name(), this);
|
||||||
|
li->setPos(0, _items.size() * li->boundingRect().height());
|
||||||
|
|
||||||
|
_items.append(li);
|
||||||
|
|
||||||
|
_boundingRect = QRectF(0, 0, qMax(_boundingRect.width(),
|
||||||
|
li->boundingRect().width()), _items.size() * li->boundingRect().height());
|
||||||
|
|
||||||
|
QObject::connect(li, &LegendEntryItem::selected, item, &PlaneItem::hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LegendItem::setColor(const QColor &color)
|
void LegendItem::setColor(const QColor &color)
|
||||||
{
|
{
|
||||||
_color = color;
|
for (int i = 0; i < _items.size(); i++)
|
||||||
update();
|
_items.at(i)->setTextColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LegendItem::setBackgroundColor(const QColor &color)
|
void LegendItem::setBackgroundColor(const QColor &color)
|
||||||
@ -84,6 +91,8 @@ void LegendItem::drawBackground(bool draw)
|
|||||||
void LegendItem::clear()
|
void LegendItem::clear()
|
||||||
{
|
{
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
|
|
||||||
|
qDeleteAll(_items);
|
||||||
_items.clear();
|
_items.clear();
|
||||||
_boundingRect = QRectF();
|
_boundingRect = QRectF();
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,11 @@
|
|||||||
|
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
|
|
||||||
class LegendItem : public QGraphicsItem
|
class LegendEntryItem;
|
||||||
|
class PathItem;
|
||||||
|
class PlaneItem;
|
||||||
|
|
||||||
|
class LegendItem : public QGraphicsItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LegendItem(QGraphicsItem *parent = 0);
|
LegendItem(QGraphicsItem *parent = 0);
|
||||||
@ -12,27 +16,18 @@ public:
|
|||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
QWidget *widget);
|
QWidget *widget);
|
||||||
|
|
||||||
|
void addItem(PathItem *item);
|
||||||
|
void addItem(PlaneItem *item);
|
||||||
void setDigitalZoom(qreal zoom);
|
void setDigitalZoom(qreal zoom);
|
||||||
void addItem(const QColor &color, const QString &text);
|
|
||||||
void setColor(const QColor &color);
|
void setColor(const QColor &color);
|
||||||
void setBackgroundColor(const QColor &color);
|
void setBackgroundColor(const QColor &color);
|
||||||
void drawBackground(bool draw);
|
void drawBackground(bool draw);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Item
|
QList<LegendEntryItem*> _items;
|
||||||
{
|
|
||||||
Item(const QColor &color, const QString &text)
|
|
||||||
: color(color), text(text) {}
|
|
||||||
|
|
||||||
QColor color;
|
|
||||||
QString text;
|
|
||||||
};
|
|
||||||
|
|
||||||
QList<Item> _items;
|
|
||||||
QRectF _boundingRect;
|
QRectF _boundingRect;
|
||||||
QColor _color, _bgColor;
|
QColor _bgColor;
|
||||||
QFont _font;
|
|
||||||
bool _drawBackground;
|
bool _drawBackground;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -205,6 +205,16 @@ void MapItem::setDigitalZoom(int zoom)
|
|||||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MapItem::hover(bool hvr)
|
||||||
|
{
|
||||||
|
if (hvr)
|
||||||
|
_pen.setWidthF((_width + 1) * pow(2, -_digitalZoom));
|
||||||
|
else
|
||||||
|
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
void MapItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
void MapItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
class MapAction;
|
class MapAction;
|
||||||
class Projection;
|
class Projection;
|
||||||
|
|
||||||
class MapItem : public QObject, public PlaneItem
|
class MapItem : public PlaneItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -32,6 +32,9 @@ public:
|
|||||||
const QColor color() const {return _pen.color();}
|
const QColor color() const {return _pen.color();}
|
||||||
const QString &name() const {return _name;}
|
const QString &name() const {return _name;}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void hover(bool hvr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void triggered();
|
void triggered();
|
||||||
|
|
||||||
|
@ -153,30 +153,18 @@ void MapView::updateLegend()
|
|||||||
|
|
||||||
if (_showTracks) {
|
if (_showTracks) {
|
||||||
for (int i = 0; i < _tracks.size(); i++)
|
for (int i = 0; i < _tracks.size(); i++)
|
||||||
addLegendEntry(_tracks.at(i));
|
_legend->addItem(_tracks.at(i));
|
||||||
}
|
}
|
||||||
if (_showRoutes) {
|
if (_showRoutes) {
|
||||||
for (int i = 0; i < _routes.size(); i++)
|
for (int i = 0; i < _routes.size(); i++)
|
||||||
addLegendEntry(_routes.at(i));
|
_legend->addItem(_routes.at(i));
|
||||||
}
|
}
|
||||||
if (_showAreas) {
|
if (_showAreas) {
|
||||||
for (int i = 0; i < _areas.size(); i++)
|
for (int i = 0; i < _areas.size(); i++)
|
||||||
addLegendEntry(_areas.at(i));
|
_legend->addItem(_areas.at(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::addLegendEntry(const PathItem *ti)
|
|
||||||
{
|
|
||||||
_legend->addItem(ti->color(), ti->name().isEmpty()
|
|
||||||
? QFileInfo(ti->file()).fileName() : ti->name());
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapView::addLegendEntry(const PlaneItem *plane)
|
|
||||||
{
|
|
||||||
if (!plane->name().isEmpty())
|
|
||||||
_legend->addItem(plane->color(), plane->name());
|
|
||||||
}
|
|
||||||
|
|
||||||
PathItem *MapView::addTrack(const Track &track)
|
PathItem *MapView::addTrack(const Track &track)
|
||||||
{
|
{
|
||||||
if (!track.isValid()) {
|
if (!track.isValid()) {
|
||||||
@ -204,7 +192,7 @@ PathItem *MapView::addTrack(const Track &track)
|
|||||||
|
|
||||||
if (_showTracks) {
|
if (_showTracks) {
|
||||||
addPOI(_poi->points(ti->path()));
|
addPOI(_poi->points(ti->path()));
|
||||||
addLegendEntry(ti);
|
_legend->addItem(ti);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ti;
|
return ti;
|
||||||
@ -238,7 +226,7 @@ PathItem *MapView::addRoute(const Route &route)
|
|||||||
|
|
||||||
if (_showRoutes) {
|
if (_showRoutes) {
|
||||||
addPOI(_poi->points(ri->path()));
|
addPOI(_poi->points(ri->path()));
|
||||||
addLegendEntry(ri);
|
_legend->addItem(ri);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ri;
|
return ri;
|
||||||
@ -266,7 +254,7 @@ void MapView::addArea(const Area &area)
|
|||||||
|
|
||||||
if (_showAreas) {
|
if (_showAreas) {
|
||||||
addPOI(_poi->points(ai->bounds()));
|
addPOI(_poi->points(ai->bounds()));
|
||||||
addLegendEntry(ai);
|
_legend->addItem(ai);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +297,7 @@ MapItem *MapView::addMap(MapAction *map)
|
|||||||
|
|
||||||
if (_showAreas) {
|
if (_showAreas) {
|
||||||
addPOI(_poi->points(mi->bounds()));
|
addPOI(_poi->points(mi->bounds()));
|
||||||
addLegendEntry(mi);
|
_legend->addItem(mi);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mi;
|
return mi;
|
||||||
|
@ -168,8 +168,6 @@ private:
|
|||||||
void pinchGesture(QPinchGesture *gesture);
|
void pinchGesture(QPinchGesture *gesture);
|
||||||
void skipColor() {_palette.nextColor();}
|
void skipColor() {_palette.nextColor();}
|
||||||
void setHidpi(bool hidpi);
|
void setHidpi(bool hidpi);
|
||||||
void addLegendEntry(const PathItem *path);
|
|
||||||
void addLegendEntry(const PlaneItem *plane);
|
|
||||||
void updateLegend();
|
void updateLegend();
|
||||||
|
|
||||||
void mouseMoveEvent(QMouseEvent *event);
|
void mouseMoveEvent(QMouseEvent *event);
|
||||||
|
@ -388,9 +388,9 @@ void PathItem::drawMarkerBackground(bool draw)
|
|||||||
_markerInfo->drawBackground(draw);
|
_markerInfo->drawBackground(draw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathItem::hover(bool hover)
|
void PathItem::hover(bool hvr)
|
||||||
{
|
{
|
||||||
if (hover) {
|
if (hvr) {
|
||||||
_pen.setWidth((width() + 1) * pow(2, -_digitalZoom));
|
_pen.setWidth((width() + 1) * pow(2, -_digitalZoom));
|
||||||
setZValue(zValue() + 1.0);
|
setZValue(zValue() + 1.0);
|
||||||
} else {
|
} else {
|
||||||
@ -401,6 +401,12 @@ void PathItem::hover(bool hover)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PathItem::hoverAll(bool hvr)
|
||||||
|
{
|
||||||
|
hover(hvr);
|
||||||
|
emit selected(hvr);
|
||||||
|
}
|
||||||
|
|
||||||
void PathItem::showMarker(bool show)
|
void PathItem::showMarker(bool show)
|
||||||
{
|
{
|
||||||
if (_showMarker == show)
|
if (_showMarker == show)
|
||||||
|
@ -60,7 +60,8 @@ public:
|
|||||||
static void setTimeZone(const QTimeZone &zone) {_timeZone = zone;}
|
static void setTimeZone(const QTimeZone &zone) {_timeZone = zone;}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void hover(bool hover);
|
void hover(bool hvr);
|
||||||
|
void hoverAll(bool hvr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void selected(bool);
|
void selected(bool);
|
||||||
|
@ -6,8 +6,10 @@
|
|||||||
|
|
||||||
class Map;
|
class Map;
|
||||||
|
|
||||||
class PlaneItem : public GraphicsItem
|
class PlaneItem : public QObject, public GraphicsItem
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PlaneItem(GraphicsItem *parent = 0) : GraphicsItem(parent) {}
|
PlaneItem(GraphicsItem *parent = 0) : GraphicsItem(parent) {}
|
||||||
|
|
||||||
@ -23,6 +25,9 @@ public:
|
|||||||
|
|
||||||
virtual const QColor color() const = 0;
|
virtual const QColor color() const = 0;
|
||||||
virtual const QString &name() const = 0;
|
virtual const QString &name() const = 0;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void hover(bool hvr) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PLANEITEM_H
|
#endif // PLANEITEM_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user