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

Items derived from Container does not deliver key events to children

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.14.0 RC1
    • 5.9.1
    • Quick: Controls 2
    • None
    • * Qt 5.9.1 MSVC32
       * Windows 10
    • 19976fd5db1f2fb4925831c5f7a708c090e4a70e (qt/qtquickcontrols2/5.14)

    Description

      I want to receive a key-pres events from an items which are children of SwipeView or another element, derived from Container item.

      This code does not work as expected:

       

      import QtQuick 2.7
      import QtQuick.Controls 2.0
      
      ApplicationWindow {
          visible: true
          width: 1020
          height: 700
      
          SwipeView {
              anchors.fill: parent
              focus: true
      
              Rectangle {
                  focus: true // makes not sense
                  color: "red"
                  Keys.onPressed: console.log("on rect1 press: " + event.key)
              }
      
              Rectangle {
                  focus: true // makes not sense
                  color: "green"
                  Keys.onPressed: console.log("on rect2 press: " + event.key)
              }
      
              Keys.onPressed: console.log("on swipe view press: " + event.key)
          }
      }
      

      I do not see debuging output for "on rect1 press" or "on rect2 press". I see only outputs "on swipe view press".

       

      Attachments

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

        Activity

          People

            mitch_curtis Mitch Curtis
            kuzulis Denis Shienkov
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes