Correctly fix the popup position

When the message to 'This dive site is being edited' was
being show while the popup to choose the dive site, the
line edit was being covered. now it correctly moves to
the correct place.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-09-23 16:03:28 -03:00 committed by Dirk Hohndel
parent d586970f31
commit 5b3d52acec
3 changed files with 9 additions and 2 deletions

View file

@ -489,7 +489,7 @@ void DiveLocationLineEdit::keyPressEvent(QKeyEvent *ev)
} }
} }
void DiveLocationLineEdit::showPopup() void DiveLocationLineEdit::fixPopupPosition()
{ {
const QRect screen = QApplication::desktop()->availableGeometry(this); const QRect screen = QApplication::desktop()->availableGeometry(this);
const int maxVisibleItems = 5; const int maxVisibleItems = 5;
@ -522,7 +522,11 @@ void DiveLocationLineEdit::showPopup()
} }
view->setGeometry(pos.x(), pos.y(), w, h); view->setGeometry(pos.x(), pos.y(), w, h);
}
void DiveLocationLineEdit::showPopup()
{
fixPopupPosition();
if (!view->isVisible()) { if (!view->isVisible()) {
setTemporaryDiveSiteName(text()); setTemporaryDiveSiteName(text());
proxy->invalidate(); proxy->invalidate();

View file

@ -85,7 +85,7 @@ public:
void itemActivated(const QModelIndex& index); void itemActivated(const QModelIndex& index);
DiveSiteType currDiveSiteType() const; DiveSiteType currDiveSiteType() const;
uint32_t currDiveSiteUuid() const; uint32_t currDiveSiteUuid() const;
void fixPopupPosition();
signals: signals:
void diveSiteSelected(uint32_t uuid); void diveSiteSelected(uint32_t uuid);

View file

@ -195,6 +195,9 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
connect(ReverseGeoLookupThread::instance(), &QThread::finished, connect(ReverseGeoLookupThread::instance(), &QThread::finished,
this, &MainTab::setCurrentLocationIndex); this, &MainTab::setCurrentLocationIndex);
connect(ui.diveNotesMessage, &KMessageWidget::showAnimationFinished,
ui.location, &DiveLocationLineEdit::fixPopupPosition);
acceptingEdit = false; acceptingEdit = false;
} }