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. How to give a JavaScript function to a qml component [solved]
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 998 Views 1 Watching
  • 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 Offline
    A Offline
    archqt
    wrote on last edited by
    #1

    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
    0
    • GianlucaG Offline
      GianlucaG Offline
      Gianluca
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • A Offline
        A Offline
        archqt
        wrote on last edited by
        #3

        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
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved