mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Made it possible to keypress again
Click outside of the popup closes it, also handles theme enter / return keys. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
fdd28fddf2
commit
534e07399a
1 changed files with 14 additions and 2 deletions
|
@ -429,7 +429,7 @@ DiveLocationLineEdit::DiveLocationLineEdit(QWidget *parent)
|
||||||
view->setSelectionMode(QAbstractItemView::SingleSelection);
|
view->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
view->setParent(0, Qt::Popup);
|
view->setParent(0, Qt::Popup);
|
||||||
view->installEventFilter(this);
|
view->installEventFilter(this);
|
||||||
view->setFocusProxy(this);
|
view->setFocusProxy(location_line_edit);
|
||||||
|
|
||||||
connect(this, &QLineEdit::textEdited, this, &DiveLocationLineEdit::setTemporaryDiveSiteName);
|
connect(this, &QLineEdit::textEdited, this, &DiveLocationLineEdit::setTemporaryDiveSiteName);
|
||||||
}
|
}
|
||||||
|
@ -437,6 +437,8 @@ DiveLocationLineEdit::DiveLocationLineEdit(QWidget *parent)
|
||||||
bool DiveLocationLineEdit::eventFilter(QObject *o, QEvent *e)
|
bool DiveLocationLineEdit::eventFilter(QObject *o, QEvent *e)
|
||||||
{
|
{
|
||||||
if(e->type() == QEvent::KeyPress) {
|
if(e->type() == QEvent::KeyPress) {
|
||||||
|
if (view->focusProxy() == this) qDebug() << "Ueh...";
|
||||||
|
else qDebug() << "Nao eh...";
|
||||||
QKeyEvent *keyEv = (QKeyEvent*) e;
|
QKeyEvent *keyEv = (QKeyEvent*) e;
|
||||||
|
|
||||||
qDebug() << view->focusProxy()->objectName();
|
qDebug() << view->focusProxy()->objectName();
|
||||||
|
@ -446,11 +448,21 @@ bool DiveLocationLineEdit::eventFilter(QObject *o, QEvent *e)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(keyEv->key() == Qt::Key_Return) {
|
if(keyEv->key() == Qt::Key_Return || keyEv->key() == Qt::Key_Enter) {
|
||||||
view->hide();
|
view->hide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(e->type() == QEvent::MouseButtonPress ) {
|
||||||
|
if (!view->underMouse()) {
|
||||||
|
view->hide();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue