Qml slot called multiple times irrespective of the signal being emitted only one time



  • I have a Qml signal which is emitted from one qml and handled in another qml.
    The slot is called multiple times irrespective of the qml signal being emitted only one time.



  • @AmazingQt Code, please. Preferrably a minimal self-contained working example.



  • In my Test.qml file

    NewDataFill {
    dialog: myInputDialog
    }

    InputDialog {
    id : myInputDialog
    signal accepted(text)
    onOkClicked: {
    accepted("2")
    }
    }

    In my NewDataFill.qml file
    property var dialog

    MouseArea {
    onclicked : {
    dialog.visible = true
    dialog.value = 5
    }

    Connections {
    target: dialog
    onAccepted: {
    console.log ( "called on accepted " )
    }
    }



  • Slot will be called multiple times only if the connection is done multiple times. Other wise there is no chance that slot will be called multiple times. I tried to look at your code. It is not self sufficient to code see your issue. If you can help us the simple piece of code which gives the problem, it will help us to help you.


Log in to reply
 

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