Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-49297

Keys signal firing twice on the TextField component

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.5.1
    • Quick: Controls 1
    • None
    • Linux 3.19.0-25-generic x86_64

    Description

      When attaching a key signal on a TextField, some keys result in the event firing twice.

      sample code :

      sample.qml
      import QtQuick 2.5
      import QtQuick.Controls.Styles 1.4
      import QtQuick.Controls 1.4
      
      Rectangle {
          height: 300
          width: 300
      
          TextField {
              x: 5
              y: 5
              style: TextFieldStyle {
                  textColor: "black"
                  background: Rectangle {
                      radius: 2
                      implicitWidth: 100
                      implicitHeight: 24
                      border.color: "#333"
                      border.width: 1
                  }
              }
              Keys.onPressed: {
                  if (event.key == Qt.Key_Return) console.log("key pressed")
              }
      
          }
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Yed_ Yedderson
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes