mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
parent
ed9ebfffac
commit
b4d240d8fe
@ -15,6 +15,8 @@ public:
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
|
||||
CoordinatesFormat format() const {return _format;}
|
||||
|
||||
void setCoordinates(const Coordinates &c);
|
||||
void setFormat(const CoordinatesFormat &format);
|
||||
void setDigitalZoom(qreal zoom);
|
||||
|
@ -720,7 +720,10 @@ void GUI::keys()
|
||||
+ "</i></td></tr><tr><td>" + tr("Zoom out") + "</td><td><i>"
|
||||
+ QKeySequence(ZOOM_OUT).toString() + "</i></td></tr><tr><td>"
|
||||
+ tr("Digital zoom") + "</td><td><i>" + QKeySequence(MODIFIER).toString()
|
||||
+ tr("Zoom") + "</i></td></tr></table></div>");
|
||||
+ tr("Zoom") + "</i></td></tr><tr><td></td><td></td></tr><tr><td>"
|
||||
+ tr("Copy coordinates") + "</td><td><i>"
|
||||
+ QKeySequence(MODIFIER).toString() + tr("Left Click")
|
||||
+ "</i></td></tr></table></div>");
|
||||
|
||||
msgBox.exec();
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define PREV_KEY Qt::Key_Backspace
|
||||
#define FIRST_KEY Qt::Key_Home
|
||||
#define LAST_KEY Qt::Key_End
|
||||
#define MODIFIER_KEY Qt::Key_Shift
|
||||
#define MODIFIER Qt::ShiftModifier
|
||||
#define ZOOM_IN Qt::Key_Plus
|
||||
#define ZOOM_OUT Qt::Key_Minus
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <QWheelEvent>
|
||||
#include <QApplication>
|
||||
#include <QScrollBar>
|
||||
#include <QClipboard>
|
||||
#include "data/poi.h"
|
||||
#include "data/data.h"
|
||||
#include "map/map.h"
|
||||
@ -522,7 +523,12 @@ void MapView::keyPressEvent(QKeyEvent *event)
|
||||
else if (_digitalZoom && event->key() == Qt::Key_Escape) {
|
||||
digitalZoom(0);
|
||||
return;
|
||||
} else {
|
||||
} else {
|
||||
if (event->key() == MODIFIER_KEY) {
|
||||
_cursor = viewport()->cursor();
|
||||
viewport()->setCursor(Qt::CrossCursor);
|
||||
}
|
||||
|
||||
QGraphicsView::keyPressEvent(event);
|
||||
return;
|
||||
}
|
||||
@ -530,6 +536,23 @@ void MapView::keyPressEvent(QKeyEvent *event)
|
||||
zoom(z, pos);
|
||||
}
|
||||
|
||||
void MapView::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == MODIFIER_KEY && viewport()->cursor() == Qt::CrossCursor)
|
||||
viewport()->setCursor(_cursor);
|
||||
|
||||
QGraphicsView::keyReleaseEvent(event);
|
||||
}
|
||||
|
||||
void MapView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && event->modifiers() & MODIFIER)
|
||||
QGuiApplication::clipboard()->setText(Format::coordinates(
|
||||
_map->xy2ll(mapToScene(event->pos())), _coordinates->format()));
|
||||
else
|
||||
QGraphicsView::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
||||
PlotFlags flags)
|
||||
{
|
||||
|
@ -123,13 +123,15 @@ private:
|
||||
void updatePOIVisibility();
|
||||
void skipColor() {_palette.nextColor();}
|
||||
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void keyReleaseEvent(QKeyEvent *event);
|
||||
void drawBackground(QPainter *painter, const QRectF &rect);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void scrollContentsBy(int dx, int dy);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
|
||||
GraphicsScene *_scene;
|
||||
@ -163,6 +165,7 @@ private:
|
||||
|
||||
int _digitalZoom;
|
||||
bool _plot;
|
||||
QCursor _cursor;
|
||||
|
||||
#ifdef ENABLE_HIDPI
|
||||
qreal _deviceRatio;
|
||||
|
Loading…
Reference in New Issue
Block a user