summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/maintab.cpp26
-rw-r--r--qt-ui/maintab.h1
2 files changed, 27 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) {
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index 332285949..6a55580b7 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -54,6 +54,7 @@ public:
void updateCoordinatesText(qreal lat, qreal lon);
void nextInputField(QKeyEvent *event);
void showAndTriggerEditSelective(struct dive_components what);
+ virtual bool eventFilter(QObject*, QEvent*);
signals:
void addDiveFinished();