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. Call main.qml function from another qml

Call main.qml function from another qml

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 813 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.
  • D Offline
    D Offline
    DavidM29
    wrote on last edited by
    #1

    Hello,

    I have a function in my main.qml I would like to know how can I access it from another qml file.

    For example :
    main.qml contains funct1()
    in my foo.qml I want to do something like main.funct1()

    Is this possible ?

    Thank you in advance

    1 Reply Last reply
    0
    • D Offline
      D Offline
      daljit97
      wrote on last edited by
      #2

      Well everything should be "contained" in the main file any way, so each element of the other files should have as parent the main "Window" or "ApplicationWindow", so unless your app has a structure that deviates from the "standard" you could just call funct1() as long as you define it at the top of your main.qml.

      1 Reply Last reply
      1
      • D Offline
        D Offline
        DavidM29
        wrote on last edited by
        #3

        Ok I understand now ! My problem was because I did not put the function at the top of the main.qml
        Thanks for your help

        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