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. Signal handler not called in qmlscene
QtWS25 Last Chance

Signal handler not called in qmlscene

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 361 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.
  • F Offline
    F Offline
    Ferenc
    wrote on 4 Sept 2021, 14:40 last edited by Ferenc 9 Apr 2021, 15:02
    #1

    Hi all,

    The following snippet uses PointHandler to track touch events. It is running normally on the target device (embedded device with touchscreen, executing Qt (C++) application), but calls only the direct signal handler testing on my laptop with qmlscene.

    import QtQuick 2.12
    
    Item {
        id: root
        Rectangle {
            anchors.fill: parent
    
            PointHandler {
                id: handler
                property alias position: handler.point.position
                onPositionChanged: function () {
                    console.log("xxx")
                }
            }
        }
    
        Canvas {
            anchors.fill: parent
    
            Connections {
                target: handler
                function onPositionChanged() {
                    console.log("yyy")
                }
            }
        }
    }
    

    Running the code above with qmlscene and clicking into the window results in logging only 'xxx' rows:

    $ qmlscene tmptest.qml 
    qml: xxx
    qml: xxx
    qml: xxx
    [...]
    

    Am I doing something wrong, or is it a bug?

    Ubuntu 20.04

    Package: libqt5qml5
    Version: 5.12.8-0ubuntu1

    Package: qmlscene
    Version: 5.12.8-0ubuntu1

    Thanks,
    Ferenc

    K 1 Reply Last reply 6 Sept 2021, 06:03
    0
    • F Ferenc
      4 Sept 2021, 14:40

      Hi all,

      The following snippet uses PointHandler to track touch events. It is running normally on the target device (embedded device with touchscreen, executing Qt (C++) application), but calls only the direct signal handler testing on my laptop with qmlscene.

      import QtQuick 2.12
      
      Item {
          id: root
          Rectangle {
              anchors.fill: parent
      
              PointHandler {
                  id: handler
                  property alias position: handler.point.position
                  onPositionChanged: function () {
                      console.log("xxx")
                  }
              }
          }
      
          Canvas {
              anchors.fill: parent
      
              Connections {
                  target: handler
                  function onPositionChanged() {
                      console.log("yyy")
                  }
              }
          }
      }
      

      Running the code above with qmlscene and clicking into the window results in logging only 'xxx' rows:

      $ qmlscene tmptest.qml 
      qml: xxx
      qml: xxx
      qml: xxx
      [...]
      

      Am I doing something wrong, or is it a bug?

      Ubuntu 20.04

      Package: libqt5qml5
      Version: 5.12.8-0ubuntu1

      Package: qmlscene
      Version: 5.12.8-0ubuntu1

      Thanks,
      Ferenc

      K Offline
      K Offline
      KroMignon
      wrote on 6 Sept 2021, 06:03 last edited by
      #2

      @Ferenc said in Signal handler not called in qmlscene:

      Am I doing something wrong, or is it a bug?

      Maybe I am wrong but guess handler is out of scope of the Canvas.

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      F 1 Reply Last reply 8 Sept 2021, 20:40
      0
      • K KroMignon
        6 Sept 2021, 06:03

        @Ferenc said in Signal handler not called in qmlscene:

        Am I doing something wrong, or is it a bug?

        Maybe I am wrong but guess handler is out of scope of the Canvas.

        F Offline
        F Offline
        Ferenc
        wrote on 8 Sept 2021, 20:40 last edited by
        #3

        @KroMignon It is in the same file, why would not be? And after all, it works correctly in a Qt application, so why it behaves differently in qmlscene?

        1 Reply Last reply
        0

        1/3

        4 Sept 2021, 14:40

        • Login

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