Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Reusable component using difference function



  • Hi there....
    i want to create reusable component with rectangle and mouse Area but if use that component, i want to call different function,. can i achieve that?
    please give me a example.. thanks a lot guys



  • @mr.jo Hi,
    exemple :

    //ExempleComp.qml
    Rectangle{
    signal mySignal()
    MouseArea{
    anchors.fill:parent
    onClicked:mySignal()
    }
    }
    
    //main.qml
    

    function mySignalHandler(_ind) {
    switch(_ind)...
    }

    Repeater{
    model:5
    ExempleComp{
    onMySignal: mySignalHandler(index)
    }
    }



  • @LeLev thanks a lot mabroooo...


Log in to reply