1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-08 08:14:28 +02:00

Added the "show cursor coordinates" option

Closes #167
This commit is contained in:
2019-02-17 20:20:20 +01:00
parent 3d0c36b459
commit 12f3c252bb
8 changed files with 154 additions and 5 deletions

View File

@ -313,6 +313,11 @@ void GUI::createActions()
_showMapAction->setEnabled(false);
_clearMapCacheAction->setEnabled(false);
}
_showCoordinatesAction = new QAction(tr("Show cursor coordinates"), this);
_showCoordinatesAction->setMenuRole(QAction::NoRole);
_showCoordinatesAction->setCheckable(true);
connect(_showCoordinatesAction, SIGNAL(triggered(bool)), _mapView,
SLOT(showCoordinates(bool)));
// Data actions
_showTracksAction = new QAction(tr("Show tracks"), this);
@ -502,6 +507,8 @@ void GUI::createMenus()
_mapMenu->addAction(_loadMapAction);
_mapMenu->addAction(_clearMapCacheAction);
_mapMenu->addSeparator();
_mapMenu->addAction(_showCoordinatesAction);
_mapMenu->addSeparator();
_mapMenu->addAction(_showMapAction);
QMenu *graphMenu = menuBar()->addMenu(tr("&Graph"));
@ -1674,6 +1681,8 @@ void GUI::writeSettings()
settings.setValue(CURRENT_MAP_SETTING, _map->name());
if (_showMapAction->isChecked() != SHOW_MAP_DEFAULT)
settings.setValue(SHOW_MAP_SETTING, _showMapAction->isChecked());
if (_showCoordinatesAction->isChecked() != SHOW_COORDINATES_DEFAULT)
settings.setValue(SHOW_COORDINATES_SETTING, _showMapAction->isChecked());
settings.endGroup();
settings.beginGroup(GRAPH_SETTINGS_GROUP);
@ -1897,6 +1906,11 @@ void GUI::readSettings()
int index = mapIndex(settings.value(CURRENT_MAP_SETTING).toString());
_mapActions.at(index)->trigger();
}
if (settings.value(SHOW_COORDINATES_SETTING, SHOW_COORDINATES_DEFAULT)
.toBool()) {
_showCoordinatesAction->setChecked(true);
_mapView->showCoordinates(true);
}
settings.endGroup();
settings.beginGroup(GRAPH_SETTINGS_GROUP);