Send the signal once, but recived twice.



  • I surely send only once in the Item out of the delegate which is a delegate for ListView.
    And I Can get from the information it prints when sending the signal. But Why the delegate receive twice ?
    I use the Connections normally in the delegate
    @
    Connectoins {
    target: myiten//out of the deletage.And the delegate is in the other delegate qml file
    on... {

    }
    

    }
    @


  • Moderators

    Possibly you are connecting twice, either directly or indirectly, the signal and slot. I have no experience with qml, so I do not know if this is possible or not, but this might explain your case.

    I would check, if the signal-slot connection are done twice. You might want to check, if there is already a default connection and you add your own connection in addition.



  • Hi there,
    There's one tricky thing in QML that signals are automatically generated for a given property's name.
    Don't know if this is related but might be worth mentioning.

    In short, if you are using
    @
    Q_PROPERTY ( int itemCount READ getItemCount NOTIFY dataUpdated)
    @
    Whenever the dataUpdated() signal is emitted from the C++ model, the QML side will receive two signals, one called OnDataUpdated and one called onItemCountChanged. Apparently if the names are the same you'll receive the signal just once but still, I'd take a look at it.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.