diff options
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r-- | qt-ui/maintab.cpp | 26 |
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) { |