summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-07-16 18:47:57 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-16 18:34:22 -0700
commit0a473b3a2af6cab57f1fc0f360aff7e2dfeca133 (patch)
treefd9fa236a8d5d7c493311bbfa0efdac17788f60b /qt-ui/maintab.cpp
parent56240cff5ba2e8b762d3ba85cf62aafdc874d693 (diff)
downloadsubsurface-0a473b3a2af6cab57f1fc0f360aff7e2dfeca133.tar.gz
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>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 4920fab4b..fd78a10d7 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -67,7 +67,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
completer->setCompletionColumn(LocationInformationModel::NAME);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completerListview->setItemDelegate(new LocationFilterDelegate());
-
+ completerListview->setMouseTracking(true);
locationManagementEditHelper = new LocationManagementEditHelper();
connect(locationManagementEditHelper, &LocationManagementEditHelper::setLineEditText,
ui.location, &QLineEdit::setText);
@@ -453,6 +453,12 @@ void MainTab::showLocation()
void MainTab::updateDiveInfo(bool clear)
{
+ // I don't like this code here - but globe() wasn't initialized on the constructor.
+ {
+ QListView *completerListview = qobject_cast<QListView*>(ui.location->completer()->popup());
+ connect(completerListview, SIGNAL(entered(QModelIndex)), MainWindow::instance()->globe(), SLOT(centerOnIndex(QModelIndex)), Qt::UniqueConnection);
+ }
+
EditMode rememberEM = editMode;
// don't execute this while adding / planning a dive
if (editMode == ADD || editMode == MANUALLY_ADDED_DIVE || MainWindow::instance()->graphics()->isPlanner())