Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Change Focus After Enter/ Return Key Pressed in QLineEdit.

Change Focus After Enter/ Return Key Pressed in QLineEdit.

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 16.6k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    Macro
    wrote on last edited by
    #1

    Hi..

    I am just trying to create a sample Application Form, in that i have few QLineEdits, QCheckBox and QComboBoxes in it. When the user finished Editing in a QLineEdit and if the user Presses the Enter/Return Key, the QLineEdit's Focus has to be changed to the Next Component.. How can i change a QLineEdit's Focus to the next component when an Enter/Return key is Pressed.

    Note: I tried using an Evenfilters() method.. But No use.... :( The Focus is not changing.... :( Please give ur suggestions...

    1 Reply Last reply
    0
    • ZlatomirZ Offline
      ZlatomirZ Offline
      Zlatomir
      wrote on last edited by
      #2

      QLineEdit has "editingFinished":http://qt-project.org/doc/qt-4.8/qlineedit.html#editingFinished signal, connect a slot that set the focus to the widget you want.

      https://forum.qt.io/category/41/romanian

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Macro
        wrote on last edited by
        #3

        Thanks for your Suggestion Zlatomir.. :)

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Macro
          wrote on last edited by
          #4

          huh.... FocusNextChild itself is working..... :)

          @if(keyEvent->key() == Qt::Key_Enter || keyEvent->key()== Qt::Key_Return)
          {
          this->focusNextChild();
          return false;
          }@

          1 Reply Last reply
          0

          • Login

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