Fix mouse interaction with the Location List

paint methods should be used only to paint, not to trigger other
widget behaviours ( we could got ourselves into a bad recursion
bug from that ). Also, enabled mouse tracking to correctly track
the mouse movement inside the widget.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-07-16 18:47:57 -03:00 committed by Dirk Hohndel
parent 56240cff5b
commit 0a473b3a2a
4 changed files with 21 additions and 12 deletions

View file

@ -373,6 +373,15 @@ void GlobeGPS::resizeEvent(QResizeEvent *event)
messageWidget->setGeometry(5, 5, size - 10, 0);
messageWidget->setMaximumHeight(500);
}
void GlobeGPS::centerOnIndex(const QModelIndex& idx)
{
struct dive_site *ds = get_dive_site_by_uuid(idx.model()->index(idx.row(), 0).data().toInt());
if (!ds || !dive_site_has_gps_location(ds))
MainWindow::instance()->globe()->centerOnDiveSite(&displayed_dive_site);
else
MainWindow::instance()->globe()->centerOnDiveSite(ds);
}
#else
GlobeGPS::GlobeGPS(QWidget *parent)
@ -398,4 +407,7 @@ void GlobeGPS::endGetDiveCoordinates()
void GlobeGPS::reload()
{
}
void GlobeGPS::centerOnIndex(const QModelIndex& idx)
{
}
#endif