Hello,
the connections may be established between instances of the classes not between classes themselves. Precisely, in your project you can connect object A to object B, so that object A can access and e.g. invoke methods of object B.
According to your above screenshots, you have made such connection. The TogleButton in the first screenshot is connected to the slot method StartChart of the autoobject chartpanel1. Every time the user switches on the button, the slot method is signaled.
The problem here, the method is signaled in context of the particular instance chartpanel1. If your project contains another instances of the chartpanel class, these are not affected by this. For example, if you have embedded another instance of the chartpanel class inside e.g. the application component, then your project contains in fact two instances of this class. Now, when the user interacts with the ToggleButton, only the autoobject instance is affected. The other instance embedded inside the application component is not affected.
To establish the right connection, the source component (the component containing the ToggleButton) has to know the correct destination component (the right instance of the chartpanel class). Generallyt this can be achieved by:
- storing the chartpanel instance in a variable or property existing within the source component. In this manner the source component can access chartpanel instance and communicate with it.
- accessing the right object directly through the view tree
- searching for the desired chartpanel instance within the view tree.
Please see following articles:
Implementing component interface.
Understand the view tree and the Owner relationships
Enumerate and search views existing within the component
Alternatively, you can exchange information between objects by using observers, kind of broadcast infrastructure. Please see:
attachobserver
notifyobservers
I hope it helps you further.
Best regards
Paul Banach