mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
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>
This commit is contained in:
parent
32db7e5fb5
commit
0ba832ef12
2 changed files with 27 additions and 0 deletions
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue