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. QML accessing unnamed signal parameters
Forum Updated to NodeBB v4.3 + New Features

QML accessing unnamed signal parameters

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 905 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.
  • E Offline
    E Offline
    EvilPictureBook
    wrote on 2 Aug 2018, 23:13 last edited by
    #1

    Hi,

    I was wondering if someone could help me.

    I'm emitting signals from python using PySide2:

    signal_random = QtCore.Signal(float)
    #  ...and then ...
    self.signal_random.emit(1.0)
    

    I can't find any way to send a named signal, and I'm not sure how to access the data in this signal in QML.

    What I have now in QML:

    Text {
        id: text2
        x: 505
        y: 357
        width: 134
        height: 40
        text: "test"
        font.pixelSize: 20
    
        Connections {
            target: worker
            onSignal_random: {
                text2.text="SIGNALED"
            }
        }
    }
    

    This works fine, and the text changes from "test" to "SIGNALED", but I have no idea how to get at the data in the signal (and for example display it in the text field).

    So I was hoping someone here could point me in the right direction. Am I missing something on naming the signal parameter in PySide2, or is there a default way to access unnamed signal parameters?

    Thanks.

    (I have this working if I use properties with a change notify, but I would like to get this to work as well)

    D 1 Reply Last reply 3 Aug 2018, 09:32
    0
    • E EvilPictureBook
      2 Aug 2018, 23:13

      Hi,

      I was wondering if someone could help me.

      I'm emitting signals from python using PySide2:

      signal_random = QtCore.Signal(float)
      #  ...and then ...
      self.signal_random.emit(1.0)
      

      I can't find any way to send a named signal, and I'm not sure how to access the data in this signal in QML.

      What I have now in QML:

      Text {
          id: text2
          x: 505
          y: 357
          width: 134
          height: 40
          text: "test"
          font.pixelSize: 20
      
          Connections {
              target: worker
              onSignal_random: {
                  text2.text="SIGNALED"
              }
          }
      }
      

      This works fine, and the text changes from "test" to "SIGNALED", but I have no idea how to get at the data in the signal (and for example display it in the text field).

      So I was hoping someone here could point me in the right direction. Am I missing something on naming the signal parameter in PySide2, or is there a default way to access unnamed signal parameters?

      Thanks.

      (I have this working if I use properties with a change notify, but I would like to get this to work as well)

      D Offline
      D Offline
      Diracsbracket
      wrote on 3 Aug 2018, 09:32 last edited by Diracsbracket 8 Mar 2018, 09:40
      #2

      @EvilPictureBook
      https://stackoverflow.com/questions/10506398/pyside-signal-argument-cant-be-retrieved-from-qml

      1 Reply Last reply
      2
      • E Offline
        E Offline
        EvilPictureBook
        wrote on 3 Aug 2018, 14:53 last edited by
        #3

        That did it, thank you!

        1 Reply Last reply
        0

        2/3

        3 Aug 2018, 09:32

        • Login

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