hello,
can somebody please explain why do I create in qt public slots but not public
signals, thanks in advance
views:
65answers:
2Slots are normal functions, and can be public, private or protected.
Signals are always protected when eventually generated by the 'moc' program.
But note this (from some old Qt 4.1 docs):
Since slots are normal member functions, they follow the normal C++ rules when called directly. However, as slots, they can be invoked by any component, regardless of its access level, via a signal-slot connection. This means that a signal emitted from an instance of an arbitrary class can cause a private slot to be invoked in an instance of an unrelated class.
SLOTS
are functions which can be public, private or protected.Functions are called from any where i.e with in the class or outside the class.But SIGNALS
are like events and it should be emitted within the class or from the inherited class so SIGNALS
are always protected.