mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-27 11:39:16 +02:00
Added HiDPI displays/maps support
This commit is contained in:
@ -43,10 +43,6 @@ AxisItem::AxisItem(Type type, QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||
|
||||
_font.setPixelSize(FONT_SIZE);
|
||||
_font.setFamily(FONT_FAMILY);
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||
#endif // Q_OS_MAC
|
||||
}
|
||||
|
||||
void AxisItem::setRange(const RangeF &range)
|
||||
|
107
src/GUI/gui.cpp
107
src/GUI/gui.cpp
@ -1,3 +1,4 @@
|
||||
#include "config.h"
|
||||
#include <QApplication>
|
||||
#include <QSplitter>
|
||||
#include <QVBoxLayout>
|
||||
@ -22,12 +23,16 @@
|
||||
#include <QMimeData>
|
||||
#include <QUrl>
|
||||
#include <QPixmapCache>
|
||||
#ifdef ENABLE_HIDPI
|
||||
#include <QWindow>
|
||||
#include <QScreen>
|
||||
#endif // ENABLE_HIDPI
|
||||
#include <QStyle>
|
||||
#include "data/data.h"
|
||||
#include "data/poi.h"
|
||||
#include "map/maplist.h"
|
||||
#include "map/emptymap.h"
|
||||
#include "map/downloader.h"
|
||||
#include "config.h"
|
||||
#include "icons.h"
|
||||
#include "keys.h"
|
||||
#include "settings.h"
|
||||
@ -48,6 +53,8 @@
|
||||
#include "gui.h"
|
||||
|
||||
|
||||
#define TOOLBAR_ICON_SIZE 22
|
||||
|
||||
GUI::GUI()
|
||||
{
|
||||
loadMaps();
|
||||
@ -72,7 +79,7 @@ GUI::GUI()
|
||||
_splitter->setStretchFactor(1, 1);
|
||||
setCentralWidget(_splitter);
|
||||
|
||||
setWindowIcon(QIcon(QPixmap(APP_ICON)));
|
||||
setWindowIcon(QIcon(APP_ICON));
|
||||
setWindowTitle(APP_NAME);
|
||||
setUnifiedTitleAndToolBarOnMac(true);
|
||||
setAcceptDrops(true);
|
||||
@ -195,7 +202,7 @@ void GUI::createActions()
|
||||
_navigationActionGroup->setEnabled(false);
|
||||
|
||||
// General actions
|
||||
_exitAction = new QAction(QIcon(QPixmap(QUIT_ICON)), tr("Quit"), this);
|
||||
_exitAction = new QAction(QIcon(QUIT_ICON), tr("Quit"), this);
|
||||
_exitAction->setShortcut(QUIT_SHORTCUT);
|
||||
_exitAction->setMenuRole(QAction::QuitRole);
|
||||
connect(_exitAction, SIGNAL(triggered()), this, SLOT(close()));
|
||||
@ -208,40 +215,37 @@ void GUI::createActions()
|
||||
_keysAction = new QAction(tr("Keyboard controls"), this);
|
||||
_keysAction->setMenuRole(QAction::NoRole);
|
||||
connect(_keysAction, SIGNAL(triggered()), this, SLOT(keys()));
|
||||
_aboutAction = new QAction(QIcon(QPixmap(APP_ICON)),
|
||||
tr("About GPXSee"), this);
|
||||
_aboutAction = new QAction(QIcon(APP_ICON), tr("About GPXSee"), this);
|
||||
_aboutAction->setMenuRole(QAction::AboutRole);
|
||||
connect(_aboutAction, SIGNAL(triggered()), this, SLOT(about()));
|
||||
|
||||
// File actions
|
||||
_openFileAction = new QAction(QIcon(QPixmap(OPEN_FILE_ICON)),
|
||||
tr("Open..."), this);
|
||||
_openFileAction = new QAction(QIcon(OPEN_FILE_ICON), tr("Open..."), this);
|
||||
_openFileAction->setMenuRole(QAction::NoRole);
|
||||
_openFileAction->setShortcut(OPEN_SHORTCUT);
|
||||
connect(_openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));
|
||||
addAction(_openFileAction);
|
||||
_printFileAction = new QAction(QIcon(QPixmap(PRINT_FILE_ICON)),
|
||||
tr("Print..."), this);
|
||||
_printFileAction = new QAction(QIcon(PRINT_FILE_ICON), tr("Print..."),
|
||||
this);
|
||||
_printFileAction->setMenuRole(QAction::NoRole);
|
||||
_printFileAction->setActionGroup(_fileActionGroup);
|
||||
connect(_printFileAction, SIGNAL(triggered()), this, SLOT(printFile()));
|
||||
addAction(_printFileAction);
|
||||
_exportFileAction = new QAction(QIcon(QPixmap(EXPORT_FILE_ICON)),
|
||||
_exportFileAction = new QAction(QIcon(EXPORT_FILE_ICON),
|
||||
tr("Export to PDF..."), this);
|
||||
_exportFileAction->setMenuRole(QAction::NoRole);
|
||||
_exportFileAction->setShortcut(EXPORT_SHORTCUT);
|
||||
_exportFileAction->setActionGroup(_fileActionGroup);
|
||||
connect(_exportFileAction, SIGNAL(triggered()), this, SLOT(exportFile()));
|
||||
addAction(_exportFileAction);
|
||||
_closeFileAction = new QAction(QIcon(QPixmap(CLOSE_FILE_ICON)),
|
||||
tr("Close"), this);
|
||||
_closeFileAction = new QAction(QIcon(CLOSE_FILE_ICON), tr("Close"), this);
|
||||
_closeFileAction->setMenuRole(QAction::NoRole);
|
||||
_closeFileAction->setShortcut(CLOSE_SHORTCUT);
|
||||
_closeFileAction->setActionGroup(_fileActionGroup);
|
||||
connect(_closeFileAction, SIGNAL(triggered()), this, SLOT(closeAll()));
|
||||
addAction(_closeFileAction);
|
||||
_reloadFileAction = new QAction(QIcon(QPixmap(RELOAD_FILE_ICON)),
|
||||
tr("Reload"), this);
|
||||
_reloadFileAction = new QAction(QIcon(RELOAD_FILE_ICON), tr("Reload"),
|
||||
this);
|
||||
_reloadFileAction->setMenuRole(QAction::NoRole);
|
||||
_reloadFileAction->setShortcut(RELOAD_SHORTCUT);
|
||||
_reloadFileAction->setActionGroup(_fileActionGroup);
|
||||
@ -255,12 +259,12 @@ void GUI::createActions()
|
||||
addAction(_statisticsAction);
|
||||
|
||||
// POI actions
|
||||
_openPOIAction = new QAction(QIcon(QPixmap(OPEN_FILE_ICON)),
|
||||
tr("Load POI file..."), this);
|
||||
_openPOIAction = new QAction(QIcon(OPEN_FILE_ICON), tr("Load POI file..."),
|
||||
this);
|
||||
_openPOIAction->setMenuRole(QAction::NoRole);
|
||||
connect(_openPOIAction, SIGNAL(triggered()), this, SLOT(openPOIFile()));
|
||||
_closePOIAction = new QAction(QIcon(QPixmap(CLOSE_FILE_ICON)),
|
||||
tr("Close POI files"), this);
|
||||
_closePOIAction = new QAction(QIcon(CLOSE_FILE_ICON), tr("Close POI files"),
|
||||
this);
|
||||
_closePOIAction->setMenuRole(QAction::NoRole);
|
||||
connect(_closePOIAction, SIGNAL(triggered()), this, SLOT(closePOIFiles()));
|
||||
_overlapPOIAction = new QAction(tr("Overlap POIs"), this);
|
||||
@ -273,8 +277,7 @@ void GUI::createActions()
|
||||
_showPOILabelsAction->setCheckable(true);
|
||||
connect(_showPOILabelsAction, SIGNAL(triggered(bool)), _mapView,
|
||||
SLOT(showPOILabels(bool)));
|
||||
_showPOIAction = new QAction(QIcon(QPixmap(SHOW_POI_ICON)),
|
||||
tr("Show POIs"), this);
|
||||
_showPOIAction = new QAction(QIcon(SHOW_POI_ICON), tr("Show POIs"), this);
|
||||
_showPOIAction->setMenuRole(QAction::NoRole);
|
||||
_showPOIAction->setCheckable(true);
|
||||
_showPOIAction->setShortcut(SHOW_POI_SHORTCUT);
|
||||
@ -284,7 +287,7 @@ void GUI::createActions()
|
||||
createPOIFilesActions();
|
||||
|
||||
// Map actions
|
||||
_showMapAction = new QAction(QIcon(QPixmap(SHOW_MAP_ICON)), tr("Show map"),
|
||||
_showMapAction = new QAction(QIcon(SHOW_MAP_ICON), tr("Show map"),
|
||||
this);
|
||||
_showMapAction->setMenuRole(QAction::NoRole);
|
||||
_showMapAction->setCheckable(true);
|
||||
@ -292,8 +295,8 @@ void GUI::createActions()
|
||||
connect(_showMapAction, SIGNAL(triggered(bool)), _mapView,
|
||||
SLOT(showMap(bool)));
|
||||
addAction(_showMapAction);
|
||||
_loadMapAction = new QAction(QIcon(QPixmap(OPEN_FILE_ICON)),
|
||||
tr("Load map..."), this);
|
||||
_loadMapAction = new QAction(QIcon(OPEN_FILE_ICON), tr("Load map..."),
|
||||
this);
|
||||
_loadMapAction->setMenuRole(QAction::NoRole);
|
||||
connect(_loadMapAction, SIGNAL(triggered()), this, SLOT(loadMap()));
|
||||
_clearMapCacheAction = new QAction(tr("Clear tile cache"), this);
|
||||
@ -344,8 +347,8 @@ void GUI::createActions()
|
||||
SLOT(showRouteWaypoints(bool)));
|
||||
|
||||
// Graph actions
|
||||
_showGraphsAction = new QAction(QIcon(QPixmap(SHOW_GRAPHS_ICON)),
|
||||
tr("Show graphs"), this);
|
||||
_showGraphsAction = new QAction(QIcon(SHOW_GRAPHS_ICON), tr("Show graphs"),
|
||||
this);
|
||||
_showGraphsAction->setMenuRole(QAction::NoRole);
|
||||
_showGraphsAction->setCheckable(true);
|
||||
_showGraphsAction->setShortcut(SHOW_GRAPHS_SHORTCUT);
|
||||
@ -439,7 +442,7 @@ void GUI::createActions()
|
||||
_DMSAction->setCheckable(true);
|
||||
_DMSAction->setActionGroup(ag);
|
||||
connect(_DMSAction, SIGNAL(triggered()), this, SLOT(setDMS()));
|
||||
_fullscreenAction = new QAction(QIcon(QPixmap(FULLSCREEN_ICON)),
|
||||
_fullscreenAction = new QAction(QIcon(FULLSCREEN_ICON),
|
||||
tr("Fullscreen mode"), this);
|
||||
_fullscreenAction->setMenuRole(QAction::NoRole);
|
||||
_fullscreenAction->setCheckable(true);
|
||||
@ -453,21 +456,19 @@ void GUI::createActions()
|
||||
SLOT(openOptions()));
|
||||
|
||||
// Navigation actions
|
||||
_nextAction = new QAction(QIcon(QPixmap(NEXT_FILE_ICON)), tr("Next"), this);
|
||||
_nextAction = new QAction(QIcon(NEXT_FILE_ICON), tr("Next"), this);
|
||||
_nextAction->setActionGroup(_navigationActionGroup);
|
||||
_nextAction->setMenuRole(QAction::NoRole);
|
||||
connect(_nextAction, SIGNAL(triggered()), this, SLOT(next()));
|
||||
_prevAction = new QAction(QIcon(QPixmap(PREV_FILE_ICON)), tr("Previous"),
|
||||
this);
|
||||
_prevAction = new QAction(QIcon(PREV_FILE_ICON), tr("Previous"), this);
|
||||
_prevAction->setMenuRole(QAction::NoRole);
|
||||
_prevAction->setActionGroup(_navigationActionGroup);
|
||||
connect(_prevAction, SIGNAL(triggered()), this, SLOT(prev()));
|
||||
_lastAction = new QAction(QIcon(QPixmap(LAST_FILE_ICON)), tr("Last"), this);
|
||||
_lastAction = new QAction(QIcon(LAST_FILE_ICON), tr("Last"), this);
|
||||
_lastAction->setMenuRole(QAction::NoRole);
|
||||
_lastAction->setActionGroup(_navigationActionGroup);
|
||||
connect(_lastAction, SIGNAL(triggered()), this, SLOT(last()));
|
||||
_firstAction = new QAction(QIcon(QPixmap(FIRST_FILE_ICON)), tr("First"),
|
||||
this);
|
||||
_firstAction = new QAction(QIcon(FIRST_FILE_ICON), tr("First"), this);
|
||||
_firstAction->setMenuRole(QAction::NoRole);
|
||||
_firstAction->setActionGroup(_navigationActionGroup);
|
||||
connect(_firstAction, SIGNAL(triggered()), this, SLOT(first()));
|
||||
@ -555,22 +556,28 @@ void GUI::createMenus()
|
||||
|
||||
void GUI::createToolBars()
|
||||
{
|
||||
int is = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
|
||||
QSize iconSize(qMin(is, TOOLBAR_ICON_SIZE), qMin(is, TOOLBAR_ICON_SIZE));
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
_fileToolBar = addToolBar(tr("File"));
|
||||
_fileToolBar->setIconSize(iconSize);
|
||||
_fileToolBar->addAction(_openFileAction);
|
||||
_fileToolBar->addAction(_reloadFileAction);
|
||||
_fileToolBar->addAction(_closeFileAction);
|
||||
_fileToolBar->addAction(_printFileAction);
|
||||
|
||||
_showToolBar = addToolBar(tr("Show"));
|
||||
_showToolBar->setIconSize(iconSize);
|
||||
_showToolBar->addAction(_showPOIAction);
|
||||
_showToolBar->addAction(_showMapAction);
|
||||
_showToolBar->addAction(_showGraphsAction);
|
||||
|
||||
_navigationToolBar = addToolBar(tr("Navigation"));
|
||||
_navigationToolBar->setIconSize(iconSize);
|
||||
_navigationToolBar->addAction(_firstAction);
|
||||
_navigationToolBar->addAction(_prevAction);
|
||||
_navigationToolBar->addAction(_nextAction);
|
||||
@ -2107,3 +2114,39 @@ qreal GUI::movingTime() const
|
||||
{
|
||||
return (_showTracksAction->isChecked()) ? _movingTime : 0;
|
||||
}
|
||||
|
||||
void GUI::show()
|
||||
{
|
||||
QMainWindow::show();
|
||||
|
||||
#ifdef ENABLE_HIDPI
|
||||
QWindow *w = windowHandle();
|
||||
connect(w->screen(), SIGNAL(logicalDotsPerInchChanged(qreal)), this,
|
||||
SLOT(logicalDotsPerInchChanged(qreal)));
|
||||
connect(w, SIGNAL(screenChanged(QScreen*)), this,
|
||||
SLOT(screenChanged(QScreen*)));
|
||||
#endif // ENABLE_HIDPI
|
||||
}
|
||||
|
||||
void GUI::screenChanged(QScreen *screen)
|
||||
{
|
||||
#ifdef ENABLE_HIDPI
|
||||
_mapView->updateDevicePixelRatio();
|
||||
|
||||
disconnect(SIGNAL(logicalDotsPerInchChanged(qreal)), this,
|
||||
SLOT(logicalDotsPerInchChanged(qreal)));
|
||||
connect(screen, SIGNAL(logicalDotsPerInchChanged(qreal)), this,
|
||||
SLOT(logicalDotsPerInchChanged(qreal)));
|
||||
#else // ENABLE_HIDPI
|
||||
Q_UNUSED(screen);
|
||||
#endif // ENABLE_HIDPI
|
||||
}
|
||||
|
||||
void GUI::logicalDotsPerInchChanged(qreal dpi)
|
||||
{
|
||||
Q_UNUSED(dpi)
|
||||
|
||||
#ifdef ENABLE_HIDPI
|
||||
_mapView->updateDevicePixelRatio();
|
||||
#endif // ENBLE_HIDPI
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ class MapView;
|
||||
class Map;
|
||||
class MapList;
|
||||
class POI;
|
||||
class QScreen;
|
||||
|
||||
class GUI : public QMainWindow
|
||||
{
|
||||
@ -37,6 +38,7 @@ public:
|
||||
GUI();
|
||||
|
||||
bool openFile(const QString &fileName);
|
||||
void show();
|
||||
|
||||
private slots:
|
||||
void about();
|
||||
@ -83,6 +85,8 @@ private slots:
|
||||
void setDMS() {setCoordinatesFormat(DMS);}
|
||||
|
||||
void sliderPositionChanged(qreal pos);
|
||||
void screenChanged(QScreen *screen);
|
||||
void logicalDotsPerInchChanged(qreal dpi);
|
||||
|
||||
private:
|
||||
typedef QPair<QDate, QDate> DateRange;
|
||||
|
@ -20,10 +20,10 @@
|
||||
#define FULLSCREEN_ICON ":/icons/view-fullscreen.png"
|
||||
|
||||
// Options dialog icons
|
||||
#define APPEARANCE_ICON ":/icons/preferences-desktop-display.png"
|
||||
#define POI_ICON ":/icons/flag_48.png"
|
||||
#define SYSTEM_ICON ":/icons/system-run.png"
|
||||
#define PRINT_EXPORT_ICON ":/icons/document-print-preview.png"
|
||||
#define APPEARANCE_ICON ":/icons/format-stroke-color.png"
|
||||
#define POI_ICON ":/icons/flag_32.png"
|
||||
#define SYSTEM_ICON ":/icons/preferences-system.png"
|
||||
#define PRINT_EXPORT_ICON ":/icons/document-print_32.png"
|
||||
#define DATA_ICON ":/icons/view-filter.png"
|
||||
|
||||
#endif /* ICONS_H */
|
||||
|
@ -9,10 +9,6 @@ InfoItem::InfoItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||
{
|
||||
_font.setPixelSize(FONT_SIZE);
|
||||
_font.setFamily(FONT_FAMILY);
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||
#endif // Q_OS_MAC
|
||||
}
|
||||
|
||||
void InfoItem::updateBoundingRect()
|
||||
|
@ -29,7 +29,6 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
|
||||
|
||||
_scene = new QGraphicsScene(this);
|
||||
setScene(_scene);
|
||||
setCacheMode(QGraphicsView::CacheBackground);
|
||||
setDragMode(QGraphicsView::ScrollHandDrag);
|
||||
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
@ -42,6 +41,10 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
|
||||
_scene->addItem(_mapScale);
|
||||
|
||||
_map = map;
|
||||
#ifdef ENABLE_HIDPI
|
||||
_ratio = devicePixelRatioF();
|
||||
_map->setDevicePixelRatio(_ratio);
|
||||
#endif // ENABLE_HIDPI
|
||||
_map->load();
|
||||
connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
|
||||
|
||||
@ -228,7 +231,7 @@ void MapView::updatePOIVisibility()
|
||||
void MapView::rescale()
|
||||
{
|
||||
_scene->setSceneRect(_map->bounds());
|
||||
resetCachedContent();
|
||||
reloadMap();
|
||||
|
||||
for (int i = 0; i < _tracks.size(); i++)
|
||||
_tracks.at(i)->setMap(_map);
|
||||
@ -265,6 +268,9 @@ void MapView::setMap(Map *map)
|
||||
disconnect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
|
||||
|
||||
_map = map;
|
||||
#ifdef ENABLE_HIDPI
|
||||
_map->setDevicePixelRatio(_ratio);
|
||||
#endif // ENABLE_HIDPI
|
||||
_map->load();
|
||||
connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
|
||||
|
||||
@ -289,7 +295,7 @@ void MapView::setMap(Map *map)
|
||||
_map->ll2xy(cr.bottomRight())).center();
|
||||
centerOn(nc);
|
||||
|
||||
resetCachedContent();
|
||||
reloadMap();
|
||||
QPixmapCache::clear();
|
||||
}
|
||||
|
||||
@ -498,6 +504,9 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
||||
// Enter plot mode
|
||||
setUpdatesEnabled(false);
|
||||
_plot = true;
|
||||
#ifdef ENABLE_HIDPI
|
||||
_map->setDevicePixelRatio(1.0);
|
||||
#endif // ENABLE_HIDPI
|
||||
|
||||
// Compute sizes & ratios
|
||||
orig = viewport()->rect();
|
||||
@ -556,6 +565,9 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
||||
_mapScale->setPos(origPos);
|
||||
|
||||
// Exit plot mode
|
||||
#ifdef ENABLE_HIDPI
|
||||
_map->setDevicePixelRatio(_ratio);
|
||||
#endif // ENABLE_HIDPI
|
||||
_plot = false;
|
||||
setUpdatesEnabled(true);
|
||||
}
|
||||
@ -635,7 +647,7 @@ void MapView::showRouteWaypoints(bool show)
|
||||
void MapView::showMap(bool show)
|
||||
{
|
||||
_showMap = show;
|
||||
resetCachedContent();
|
||||
reloadMap();
|
||||
}
|
||||
|
||||
void MapView::showPOI(bool show)
|
||||
@ -738,13 +750,13 @@ void MapView::setPOIColor(const QColor &color)
|
||||
void MapView::setMapOpacity(int opacity)
|
||||
{
|
||||
_opacity = opacity / 100.0;
|
||||
resetCachedContent();
|
||||
reloadMap();
|
||||
}
|
||||
|
||||
void MapView::setBackgroundColor(const QColor &color)
|
||||
{
|
||||
_backgroundColor = color;
|
||||
resetCachedContent();
|
||||
reloadMap();
|
||||
}
|
||||
|
||||
void MapView::drawBackground(QPainter *painter, const QRectF &rect)
|
||||
@ -819,5 +831,44 @@ void MapView::setMarkerColor(const QColor &color)
|
||||
|
||||
void MapView::reloadMap()
|
||||
{
|
||||
resetCachedContent();
|
||||
_scene->invalidate();
|
||||
}
|
||||
|
||||
void MapView::updateDevicePixelRatio()
|
||||
{
|
||||
#ifdef ENABLE_HIDPI
|
||||
if (_ratio == devicePixelRatioF())
|
||||
return;
|
||||
|
||||
_ratio = devicePixelRatioF();
|
||||
|
||||
QRectF vr(mapToScene(viewport()->rect()).boundingRect()
|
||||
.intersected(_map->bounds()));
|
||||
RectC cr(_map->xy2ll(vr.topLeft()), _map->xy2ll(vr.bottomRight()));
|
||||
|
||||
_map->setDevicePixelRatio(_ratio);
|
||||
|
||||
digitalZoom(0);
|
||||
|
||||
_map->zoomFit(viewport()->rect().size(), cr);
|
||||
_scene->setSceneRect(_map->bounds());
|
||||
|
||||
for (int i = 0; i < _tracks.size(); i++)
|
||||
_tracks.at(i)->setMap(_map);
|
||||
for (int i = 0; i < _routes.size(); i++)
|
||||
_routes.at(i)->setMap(_map);
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->setMap(_map);
|
||||
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
it.value()->setMap(_map);
|
||||
updatePOIVisibility();
|
||||
|
||||
QPointF nc = QRectF(_map->ll2xy(cr.topLeft()),
|
||||
_map->ll2xy(cr.bottomRight())).center();
|
||||
centerOn(nc);
|
||||
|
||||
reloadMap();
|
||||
#endif // ENABLE_HIDPI
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "units.h"
|
||||
#include "format.h"
|
||||
#include "palette.h"
|
||||
#include "config.h"
|
||||
|
||||
class Data;
|
||||
class POI;
|
||||
@ -68,6 +69,7 @@ public slots:
|
||||
void showRouteWaypoints(bool show);
|
||||
void clearMapCache();
|
||||
void setCoordinatesFormat(CoordinatesFormat format);
|
||||
void updateDevicePixelRatio();
|
||||
|
||||
private slots:
|
||||
void updatePOI();
|
||||
@ -136,6 +138,10 @@ private:
|
||||
|
||||
int _digitalZoom;
|
||||
bool _plot;
|
||||
|
||||
#ifdef ENABLE_HIDPI
|
||||
qreal _ratio;
|
||||
#endif // ENABLE_HIDPI
|
||||
};
|
||||
|
||||
#endif // MAPVIEW_H
|
||||
|
@ -492,14 +492,14 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
|
||||
|
||||
QListWidget *menu = new QListWidget();
|
||||
menu->setIconSize(QSize(MENU_ICON_SIZE, MENU_ICON_SIZE));
|
||||
new QListWidgetItem(QIcon(QPixmap(APP_ICON)), tr("General"), menu);
|
||||
new QListWidgetItem(QIcon(QPixmap(APPEARANCE_ICON)), tr("Appearance"),
|
||||
new QListWidgetItem(QIcon(APP_ICON), tr("General"), menu);
|
||||
new QListWidgetItem(QIcon(APPEARANCE_ICON), tr("Appearance"),
|
||||
menu);
|
||||
new QListWidgetItem(QIcon(QPixmap(DATA_ICON)), tr("Data"), menu);
|
||||
new QListWidgetItem(QIcon(QPixmap(POI_ICON)), tr("POI"), menu);
|
||||
new QListWidgetItem(QIcon(QPixmap(PRINT_EXPORT_ICON)), tr("Print & Export"),
|
||||
new QListWidgetItem(QIcon(DATA_ICON), tr("Data"), menu);
|
||||
new QListWidgetItem(QIcon(POI_ICON), tr("POI"), menu);
|
||||
new QListWidgetItem(QIcon(PRINT_EXPORT_ICON), tr("Print & Export"),
|
||||
menu);
|
||||
new QListWidgetItem(QIcon(QPixmap(SYSTEM_ICON)), tr("System"), menu);
|
||||
new QListWidgetItem(QIcon(SYSTEM_ICON), tr("System"), menu);
|
||||
|
||||
QHBoxLayout *contentLayout = new QHBoxLayout();
|
||||
contentLayout->addWidget(menu);
|
||||
|
@ -20,10 +20,6 @@ ScaleItem::ScaleItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||
|
||||
_font.setPixelSize(FONT_SIZE);
|
||||
_font.setFamily(FONT_FAMILY);
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||
#endif // Q_OS_MAC
|
||||
}
|
||||
|
||||
void ScaleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
|
Reference in New Issue
Block a user