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. Reusable component using difference function
Forum Updated to NodeBB v4.3 + New Features

Reusable component using difference function

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 488 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.
  • M Offline
    M Offline
    mr.jo
    wrote on last edited by
    #1

    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

    ODБOïO 1 Reply Last reply
    0
    • M mr.jo

      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

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      @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)
      }
      }

      M 1 Reply Last reply
      0
      • ODБOïO ODБOï

        @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)
        }
        }

        M Offline
        M Offline
        mr.jo
        wrote on last edited by
        #3

        @LeLev thanks a lot mabroooo...

        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