At some place you will instantiate both files. Let's assume it is a TabView
. This is the point where you will make the connection between the two files by adding a property to the TabView
that will hold the shared value.
The pro of having the sharedValue
is, that the time where the two files will be instantiated can be different, so if you destroy the instance of file1
and create the instance of file2
a couple of minutes later, you can still have the value.
TabView {
property int sharedValue
File1 {
id: file1
}
File2 {
id: file2
}
}
Then you read this on bidirectional bindings and bind the two exposed values of the dials to the shared value. You can alternatively omit the property sharedValue
and install the bidirectional binding between both exposed values directly.
What is necessary, of course, is that you expose the value of the dial, so your files would need to look
Tab {
property alias dialValue: dial.value // now you can access the dial's value via this new property.
CustomDial {
id: dial
}
}
As long as you don't alter the values in the binding, I reccommend to use two Binding
-Object to install the bidirectional binding.