Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [ Android ] How make keyboard hide trigger QLinedEdit finished ?

[ Android ] How make keyboard hide trigger QLinedEdit finished ?

Scheduled Pinned Locked Moved Mobile and Embedded
android keyboar
4 Posts 2 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Eddie
    wrote on 21 Mar 2015, 18:43 last edited by
    #1

    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

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on 21 Mar 2015, 19:30 last edited by A Former User
      #2

      Hi Eddie!
      Use QInputMethod:

      #include <QInputMethod>
      QInputMethod * QGuiApplication::​inputMethod() [static]
      QInputMethod::​hide()
      

      Cheers!

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on 21 Mar 2015, 19:34 last edited by A Former User
        #3

        Oh wait...
        I think I misunderstood you m(
        For clarification: The triangular down button is not provided by your code but by android, right?

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on 21 Mar 2015, 20:12 last edited by
          #4

          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 Reply Last reply
          0

          4/4

          21 Mar 2015, 20:12

          • Login

          • Login or register to search.
          4 out of 4
          • First post
            4/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved