private/public qt signals

anton picture anton · Jan 26, 2010 · Viewed 35.1k times · Source

Can Qt signals be public or private? Can I create internal signals, which are seen only inside the class?

Update: I have a class with some internal signals. How can I make those signals invisible for other classes (encapsulation & information hiding)?

Answer

Andrei Vlasyuk picture Andrei Vlasyuk · Jan 27, 2010

No. Signals cannot be public or private. Qt signals are protected class methods.

"signals" keyword is defined in qobjectdefs.h (line 69 as for Qt 4.6.1):

#   define signals protected

UPDATE: signals are only protected upto and including all minor versions of Qt 4. From Qt 5.0 onwards they are public. See https://stackoverflow.com/a/19130831.