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

QML accessing unnamed signal parameters

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 994 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 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)

    DiracsbracketD 1 Reply Last reply
    0
    • E EvilPictureBook

      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)

      DiracsbracketD Offline
      DiracsbracketD Offline
      Diracsbracket
      wrote on last edited by Diracsbracket
      #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 last edited by
        #3

        That did it, thank you!

        1 Reply Last reply
        0

        • Login

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