I want to call myFunc()
in PageA.qml
from the main.qml
(see the onClicked
event of the Button
). I tried some property alias stuff, but nothing has worked so far. Any ideas?
Here is my PageA.qml
code:
import QtQuick 2.4
import QtQuick.Controls 1.2
Item {
function myFunc() { /* ... */ }
TextField { id: myText }
}
And here is my main.qml
:
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Window 2.2
ApplicationWindow {
width: 640
height: 480
visible: true
TabView {
Tab {
title: "Tab A"
PageA { }
}
// ...
}
Button {
text: "click"
onClicked: callMyFunc()
}
function callMyFunc() {
// Call myFunc() in PageA.qml or read property "text" of the TextField
}
}