aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-08-25 20:26:45 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-08-25 17:59:25 -0700
commit0ba832ef12382939ef93bb5d7f81b63c9deb7e5d (patch)
tree5defc5478f4f72360231e94a752d777f6b565e37 /qt-ui/maintab.cpp
parent32db7e5fb548b0e7b6fb486c8e65f72b20e0c802 (diff)
downloadsubsurface-0ba832ef12382939ef93bb5d7f81b63c9deb7e5d.tar.gz
Move dive site list to its correct position
When we are in display dive mode, and then edit the location text edit, going to edit dive mode, the location text edit will be moved a bit below of it's original position but the Dive Site List would be already opened, and stuck on it's original position, covering the dive list. This patch fixes that. 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.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index ec25fe36e..960b7edf8 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -226,6 +226,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
connect(ReverseGeoLookupThread::instance(), &QThread::finished,
this, &MainTab::setCurrentLocationIndex);
+ ui.location->installEventFilter(this);
acceptingEdit = false;
}
@@ -240,6 +241,31 @@ MainTab::~MainTab()
}
}
+bool MainTab::eventFilter(QObject *obj, QEvent *ev)
+{
+ QMoveEvent *mEv;
+ QResizeEvent *rEv;
+ QLineEdit *line = qobject_cast<QLineEdit*>(obj);
+
+ if (ev->type() == QEvent::MouseMove || ev->type() == QEvent::HoverMove || ev->type() == QEvent::Paint)
+ return false;
+
+ if (line) {
+ if (ev->type() == QEvent::Resize) {
+ if (line->completer()->popup()->isVisible()) {
+ QListView *choices = qobject_cast<QListView*>(line->completer()->popup());
+ QPoint p = ui.location->mapToGlobal(ui.location->pos());
+ choices->setGeometry(
+ choices->geometry().x(),
+ p.y() + 3,
+ choices->geometry().width(),
+ choices->geometry().height());
+ }
+ }
+ }
+ return false;
+}
+
void MainTab::setCurrentLocationIndex()
{
if (current_dive) {