← Back to team overview

ubuntu-sdk-bugs team mailing list archive

[Bug 1537782] Re: Modifier ignored when pressing a key if TextInput has active focus

 

See the discussion on https://codereview.qt-project.org/#/c/147556/,
Qt's behaviour is correct here.

QShortcut [1], or QML's Shortcut [2] from qt-5.5 should be used for this
instead.

[1] http://doc.qt.io/qt-5/qshortcut.html
[2] http://doc.qt.io/qt-5/qml-qtquick-shortcut.html

** Changed in: qtdeclarative-opensource-src (Ubuntu)
       Status: In Progress => Invalid

** Changed in: canonical-devices-system-image
     Assignee: Michał Sawicz (saviq) => Bill Filler (bfiller)

** Changed in: canonical-devices-system-image
    Milestone: ww04-2016 => None

** Changed in: canonical-devices-system-image
       Status: In Progress => New

** Also affects: webbrowser-app (Ubuntu)
   Importance: Undecided
       Status: New

** Changed in: qtdeclarative-opensource-src (Ubuntu)
     Assignee: Michael Terry (mterry) => (unassigned)

** Summary changed:

- Modifier ignored when pressing a key if TextInput has active focus
+ Need to use (Q)Shortcuts instead of Keys.onPressed for shortcuts

** Description changed:

  On a phone with a bluetooth keyboard connected, with the following
  standalone example, if I press Ctrl+T I expect the message "Ctrl+T
  pressed" to be printed on the console, but instead the Ctrl key is
  ignored and "t" is inserted in the text field.
  
  import QtQuick 2.4
  Item {
-   TextInput {
-     anchors.centerIn: parent
-     width: parent.width - 20
-     height: 100
-     Component.onCompleted: forceActiveFocus()
-   }
-   Keys.onPressed: {
-     console.log("key pressed:", event.key, event.modifiers)
-     if (event.key == Qt.Key_T && event.modifiers == Qt.ControlModifier) {
-       console.log("Ctrl+T pressed")
-       event.accepted = true
-     }
-   }
+   TextInput {
+     anchors.centerIn: parent
+     width: parent.width - 20
+     height: 100
+     Component.onCompleted: forceActiveFocus()
+   }
+   Keys.onPressed: {
+     console.log("key pressed:", event.key, event.modifiers)
+     if (event.key == Qt.Key_T && event.modifiers == Qt.ControlModifier) {
+       console.log("Ctrl+T pressed")
+       event.accepted = true
+     }
+   }
  }
+ 
+ =========================================================================
+ 
+ See the discussion on https://codereview.qt-project.org/#/c/147556/,
+ Qt's behaviour is correct here.
+ 
+ QShortcut [1], or QML's Shortcut [2] from qt-5.5 should be used for this
+ instead.
+ 
+ [1] http://doc.qt.io/qt-5/qshortcut.html
+ [2] http://doc.qt.io/qt-5/qml-qtquick-shortcut.html

-- 
You received this bug notification because you are a member of Ubuntu
SDK bug tracking, which is subscribed to qtdeclarative-opensource-src in
Ubuntu.
https://bugs.launchpad.net/bugs/1537782

Title:
  Need to use (Q)Shortcuts instead of Keys.onPressed for shortcuts

Status in Canonical System Image:
  New
Status in qtdeclarative-opensource-src package in Ubuntu:
  Invalid
Status in webbrowser-app package in Ubuntu:
  New

Bug description:
  On a phone with a bluetooth keyboard connected, with the following
  standalone example, if I press Ctrl+T I expect the message "Ctrl+T
  pressed" to be printed on the console, but instead the Ctrl key is
  ignored and "t" is inserted in the text field.

  import QtQuick 2.4
  Item {
    TextInput {
      anchors.centerIn: parent
      width: parent.width - 20
      height: 100
      Component.onCompleted: forceActiveFocus()
    }
    Keys.onPressed: {
      console.log("key pressed:", event.key, event.modifiers)
      if (event.key == Qt.Key_T && event.modifiers == Qt.ControlModifier) {
        console.log("Ctrl+T pressed")
        event.accepted = true
      }
    }
  }

  =========================================================================

  See the discussion on https://codereview.qt-project.org/#/c/147556/,
  Qt's behaviour is correct here.

  QShortcut [1], or QML's Shortcut [2] from qt-5.5 should be used for
  this instead.

  [1] http://doc.qt.io/qt-5/qshortcut.html
  [2] http://doc.qt.io/qt-5/qml-qtquick-shortcut.html

To manage notifications about this bug go to:
https://bugs.launchpad.net/canonical-devices-system-image/+bug/1537782/+subscriptions