[ Android ] How make keyboard hide trigger QLinedEdit finished ?
-
wrote on 21 Mar 2015, 18:43 last edited by
I am saving QLineEdit text in a QLineEdit::EditingFinished handler.
One Android, how can I make closing the keyboard ( when user presses the triangular down button ) raise the EditingFinished signal?
The cursor retains focus in QLineEdit. I would like to behave as if enter or tab was pressed. Possible solutions?
Thanks in advance,
-Ed
-
wrote on 21 Mar 2015, 19:30 last edited by A Former User
Hi Eddie!
Use QInputMethod:#include <QInputMethod> QInputMethod * QGuiApplication::inputMethod() [static] QInputMethod::hide()
Cheers!
-
wrote on 21 Mar 2015, 19:34 last edited by A Former User
Oh wait...
I think I misunderstood you m(
For clarification: The triangular down button is not provided by your code but by android, right? -
wrote on 21 Mar 2015, 20:12 last edited by
Ok, sorry. Had a long day ;-)
This should work:#include <QInputMethod> [slot] void whenKeyboardVisibiliyChanged() { if (QGuiApplication::inputMethod()->isVisible()) { yourLineEdit->clearFocus(); } } connect(QGuiApplication::inputMethod(), SIGNAL(visibleChanged(), yourObject, SLOT(whenKeyboardVisibiliyChanged())));
Cheers!
1/4