PDA

View Full Version : inherit signal and slot



sajis997
22nd July 2011, 12:25
Hello forum,

If a class specialize a base call and want to access the base classes signal through connection(...), is that valid in Qt?

I have not found this is the documentation . OR did i miss it?

I have found something as follows:


connect(this, SIGNAL(base class's signal), other object, SLOT());




Regards
Sajjad

high_flyer
22nd July 2011, 13:02
If a class specialize a base call and want to access the base classes signal through connection(...), is that valid in Qt?
A sub class will inherit the base class signals/slots if they are not private, thus they for all purposes treated as its own signals/slots, just like other members.
C++ rules apply normally.

stampede
22nd July 2011, 20:41
SLOTs can be virtual too, its pretty cool ;)

Santosh Reddy
22nd July 2011, 20:59
This is one of the things which I like the about Qt C++ (may be C++ actually), either it be signals and slots both of them are normal functions at heart, and allow to be used as virtual functions, overloaded functions, overriding functions, const functions, and all-in-all they are type-safe.

I rather read signal / slots as function to function connection. :)