Signals and Slots

Slot

Signals and Slots are very similar to each other, but with a slight overhead. Emitting signals connected to a slot will be ten times slower than calling receivers directly, because the signal and its arguments must be marshalled. Emitting signals directly requires much overhead, including marshalling parameters, locating the connection object, and calling all connections. The overhead of emitting signals connected to a slot is much lower than this, though.

The word slot has several meanings in the English language. It can mean “to provide with a slot,” “to cut a slot in,” and “to drop a coin into a slot.” Other uses include “to take a position in a slot” and “to fit something into a slot.” However, the oldest sense is now obsolete. The term “slot” may also refer to the space between faceoff circles, also called a scoring area.

The word slot comes from the late 14c. meaning “hollow”. It is from Old French esclot, but its origin is unclear. It also has Old Norse roots (slod). The word first appears in print in the 1520s as a noun. The meaning of “slot machine” dates from 1888. The original meaning is “a hollow or depression for receiving a piece.”

In the VLIW world, a slot is a member function that follows the normal C++ rules when called directly. It can also be invoked by any component via a signal-slot connection. For example, a signal emitted by an arbitrary class will cause a private slot in a completely unrelated class to be invoked. As such, a slot is often considered virtual, meaning that it can be used to make a component’s function virtual.