366 views
in Embedded Wizard Studio by

Hi,

is there any way to know which slot is attached to the object?

If I use:

notifyobservers this;

How can I know which slot will be triggered?

Thanks!

John

1 Answer

+1 vote
by

Hello John,

no, it is not possible to query the slots registered to an object as observer. Observers provide just a broadcasting infrastructure. If you want several objects to communicate with each other and also access each other, you could use variables in the objects and intitialize the variables with the counterpart object. See also the section Communication between components.

Best regards

Paul Banach

by
Hello Paul,

I attached a slot method as observer to an object. Then I notified the observer. The slot method was called but I found the sender was null. Is that correct?

Thanks,

Marco
by

Hello Marco,

The slot method was called but I found the sender was null. Is that correct?

yes, this is correct. I have just discovered that our documentation incorrectly mentions notifyobservers in context of sender built-in variable. We have to correct it. When using notifyobservers, no sender information is propagated to prevent strong references to the sender object.

As alternative: see the System Event and System Event Handler. They provide a more powerful 'broadcast event' functionality and you can attach a context data to the event. The context data could be the sender in this case. Even if System Event is described in context of the Device Interface, it is very well suitable for inter-application events.

The difference between System Event and notifyobservers is: System Event manages internally a queue and each time you trigger the System Event, new event will be broadcasted to all associated handler. In other words, when you trigger System Event tree times in succession, you will receive tree notifications.

notifyobservers, in turn, accumulate the events triggered during current screen update and causes only one common event to be delivered to the associated observers. 

I hope it helps you further.

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...