mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Location edit: correctly position globe if create dive options are active
This way when the user looks through the list of completion options the globe behaves in a consistent way, i.e., if the current dive site has a GPS fix and the user activates one of the two options to create a dive site with that GPS information, the globe show the right area (and the globe zooms out if the current dive site doesn't have a GPS fix). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
076f86202a
commit
829e816e2b
1 changed files with 14 additions and 3 deletions
|
@ -507,6 +507,13 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
|||
if (index.row() < 2) {
|
||||
diveSiteName = index.data().toString();
|
||||
bottomText = index.data(Qt::ToolTipRole).toString();
|
||||
#ifndef NO_MARBLE
|
||||
if ((option.state & QStyle::State_HasFocus)) {
|
||||
// we call this even if the displayed dive site has no GPS data
|
||||
// so that the globe appropriately zooms out...
|
||||
MainWindow::instance()->globe()->centerOnDiveSite(&displayed_dive_site);
|
||||
}
|
||||
#endif
|
||||
goto print_part;
|
||||
}
|
||||
|
||||
|
@ -531,9 +538,13 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
|||
}
|
||||
|
||||
#ifndef NO_MARBLE
|
||||
if ((option.state & QStyle::State_HasFocus) && dive_site_has_gps_location(ds)) {
|
||||
qDebug() << "center on" << ds->name;
|
||||
MainWindow::instance()->globe()->centerOnDiveSite(ds);
|
||||
if ((option.state & QStyle::State_HasFocus)) {
|
||||
// show either the GPS location of the currently focused dive site or
|
||||
// the gps data for the displayed dive site (even if that has no GPS -> zoom out)
|
||||
if (dive_site_has_gps_location(ds))
|
||||
MainWindow::instance()->globe()->centerOnDiveSite(ds);
|
||||
else
|
||||
MainWindow::instance()->globe()->centerOnDiveSite(&displayed_dive_site);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue