Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. InputPanel: intercepting Enter key

InputPanel: intercepting Enter key

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 405 Views 2 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.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #1

    Hi all -

    I'm using an InputPanel for a virtual keyboard in my app. I'd like to send a signal when the enter key is pressed. Is this readily do-able?

    Thanks...

    1 Reply Last reply
    0
    • mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote on last edited by
      #2

      I thought I'd looked thoroughly before asking this, but...after posting, I found the answer:

      Dialog {
          property string inputText: ""
          signal okPressed(string newTextField)
      
          TextField {
              text: inputText
              EnterKeyAction.enabled: true
              Keys.onReleased: (event) => {
                  if (event.key === Qt.Key_Return) okPressed(inputText)
              }
      ...
      
      JoeCFDJ 1 Reply Last reply
      0
      • mzimmersM mzimmers has marked this topic as solved on
      • mzimmersM mzimmers

        I thought I'd looked thoroughly before asking this, but...after posting, I found the answer:

        Dialog {
            property string inputText: ""
            signal okPressed(string newTextField)
        
            TextField {
                text: inputText
                EnterKeyAction.enabled: true
                Keys.onReleased: (event) => {
                    if (event.key === Qt.Key_Return) okPressed(inputText)
                }
        ...
        
        JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #3

        @mzimmers I have this in a textinput

        Keys.onReturnPressed: {
        }
        
        mzimmersM 1 Reply Last reply
        2
        • JoeCFDJ JoeCFD

          @mzimmers I have this in a textinput

          Keys.onReturnPressed: {
          }
          
          mzimmersM Offline
          mzimmersM Offline
          mzimmers
          wrote on last edited by
          #4

          @JoeCFD yeah, that works, too. I keep forgetting that the Keys are associated with the input object, not the input panel itself.

          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