Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    How to give a JavaScript function to a qml component [solved]

    QML and Qt Quick
    2
    3
    848
    Loading More Posts
    • 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.
    • A
      archqt last edited by

      Hi,
      I did a QML component that use a function f(x). It works fine but i would like to give any function to this component as a property ( or another way if this one doesn't work ).
      Is there a way to do this and to be able to put several components with différents function on a screen.
      Thanks

      1 Reply Last reply Reply Quote 0
      • Gianluca
        Gianluca last edited by

        It's not clear what you want to achieve.
        Can you give us an example of your objective ?

        1 Reply Last reply Reply Quote 0
        • A
          archqt last edited by

          Hi,
          i found it. If my component use f(x) and this component is in a file Draw.qml

          Simply do it
          @
          Draw {
          function f(x) {
          return Math.cos(x)
          }
          }
          @

          Have a nice day

          1 Reply Last reply Reply Quote 0
          • First post
            Last post