From 317c3de91d6218244c58cee414d11e9f90c100ff Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 21 Sep 2015 17:18:52 -0300 Subject: Handle dive site activation Connect the view activated signal to send us the index. Removing debug output that I forgot inside it. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/locationinformation.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'qt-ui/locationinformation.cpp') diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index f8a125732..111257dfc 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -432,13 +432,12 @@ DiveLocationLineEdit::DiveLocationLineEdit(QWidget *parent) view->setFocusProxy(location_line_edit); connect(this, &QLineEdit::textEdited, this, &DiveLocationLineEdit::setTemporaryDiveSiteName); + connect(view, &QAbstractItemView::activated, this, &DiveLocationLineEdit::itemActivated); } bool DiveLocationLineEdit::eventFilter(QObject *o, QEvent *e) { if(e->type() == QEvent::KeyPress) { - if (view->focusProxy() == this) qDebug() << "Ueh..."; - else qDebug() << "Nao eh..."; QKeyEvent *keyEv = (QKeyEvent*) e; qDebug() << view->focusProxy()->objectName(); @@ -466,6 +465,11 @@ bool DiveLocationLineEdit::eventFilter(QObject *o, QEvent *e) return false; } +void DiveLocationLineEdit::itemActivated(const QModelIndex& index) +{ + qDebug() << "Activated" << index.data(); +} + void DiveLocationLineEdit::refreshDiveSiteCache() { model->resetModel(); -- cgit v1.2.3-70-g09d2