Connect , SendMessage, Emit - When should I take what?
-
Hello,
Can someone please show me how to send a SendMessage?

- From Laser to Controller
- From Ink to Controller
And when should I take what?
Connect with signal ans slots or wir SendMessage, emit? -
Adding to @Pl45m4
In order to use signal/slot connections, sender and receiver need to inherit fromQObject.@RobertSommer I am not exactly sure, what is meant by
sendMessage. There is no such thing in Qt, except for DBus and network connections which both make no sense in this context.If you mean sending events, that's another thing. Certainly also a solution for your use case, but a little more complex to handle than just using signals/slots.
-
To send a message from controller to it's inner components, you do this classically via calling the method you want to execute on the component, no need for signals or slots in that case.
However for the internal component to notify of something to the controller, then you connect the component's signal to the controller's slot.
-
Hello,
Can someone please show me how to send a SendMessage?

- From Laser to Controller
- From Ink to Controller
And when should I take what?
Connect with signal ans slots or wir SendMessage, emit?The connections mentioned by @CassD should be established in the controller class where both child objects are known.
You connectInktoControllerandLaserthe same way. I assume these are printers (or printer software)?! Ink Jet + Laser printers, right?!BTW
emitdoes nothing. It is defined to(whitespace). It's just there for us humans to distinguish between signal "calls" and functions calls. You don't need to writeemitever. It would work the same without :-)Before asking more general questions like that (nothing wrong with that), you should read
in case you haven't already.
-
Adding to @Pl45m4
In order to use signal/slot connections, sender and receiver need to inherit fromQObject.@RobertSommer I am not exactly sure, what is meant by
sendMessage. There is no such thing in Qt, except for DBus and network connections which both make no sense in this context.If you mean sending events, that's another thing. Certainly also a solution for your use case, but a little more complex to handle than just using signals/slots.
-
R RobertSommer has marked this topic as solved on
-
The connections mentioned by @CassD should be established in the controller class where both child objects are known.
You connectInktoControllerandLaserthe same way. I assume these are printers (or printer software)?! Ink Jet + Laser printers, right?!BTW
emitdoes nothing. It is defined to(whitespace). It's just there for us humans to distinguish between signal "calls" and functions calls. You don't need to writeemitever. It would work the same without :-)Before asking more general questions like that (nothing wrong with that), you should read
in case you haven't already.
@Pl45m4 said in Connect , SendMessage, Emit - When should I take what?:
You connect
InktoControllerandLaserthe same way. I assume these are printers (or printer software)?! Ink Jet + Laser printers, right?!That is correct.