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. Button pressed by Enter key
Forum Updated to NodeBB v4.3 + New Features

Button pressed by Enter key

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 255 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.
  • D Offline
    D Offline
    Damian7546
    wrote on last edited by
    #1

    Hi,

    In my popup window I have button like below:

    Button {
                    id: ok_btn
                    text: "OK"
                    width: 200
                    height: 50
                    palette.buttonText: "white"
                    background: Rectangle {
                        color: "green"
                    }
                    focus: true
                    Keys.onEnterPressed: {
                            console.log("Enter pressed!!!!!!!!!")
                    }
    
                    onClicked: {
    		  console.log("Clicked!!!!!!!!!")
                    }
    
                }
    
    

    Why press "Enter" doesn't work. ?

    J.HilkJ 1 Reply Last reply
    0
    • D Damian7546

      Hi,

      In my popup window I have button like below:

      Button {
                      id: ok_btn
                      text: "OK"
                      width: 200
                      height: 50
                      palette.buttonText: "white"
                      background: Rectangle {
                          color: "green"
                      }
                      focus: true
                      Keys.onEnterPressed: {
                              console.log("Enter pressed!!!!!!!!!")
                      }
      
                      onClicked: {
      		  console.log("Clicked!!!!!!!!!")
                      }
      
                  }
      
      

      Why press "Enter" doesn't work. ?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @Damian7546
      two questions, does your Button also have activeFocus ? and are you sure, you're pressing, enter and not return ?


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      D 1 Reply Last reply
      1
      • J.HilkJ J.Hilk

        @Damian7546
        two questions, does your Button also have activeFocus ? and are you sure, you're pressing, enter and not return ?

        D Offline
        D Offline
        Damian7546
        wrote on last edited by
        #3

        @J-Hilk said in Button pressed by Enter key:

        and are you sure, you're pressing, enter and not return ?

        You are right, I press return:/

        1 Reply Last reply
        1
        • D Damian7546 has marked this topic as solved on

        • Login

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