Advertisement
Guest User

Call a function from another QML

a guest
Jun 8th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // SomeFunc.qml
  2. Item {
  3.     function some() {
  4.         console.log("Hello")
  5.     }
  6. }
  7.  
  8. // main.qml
  9. Rectangle {
  10. width: 800
  11. height: 600
  12.  
  13. SomeFunc {
  14.     id : func
  15. }
  16.  
  17. Button {
  18.     text: qsTr("Hello, world")
  19.     onClicked: {
  20.         func.some()
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement