On Sat, May 7, 2016 at 2:29 AM, Nye <kshegu...@gmail.com> wrote: > I don't see any multiple inheritance that forms a diamond. And although I > like the older syntax better, I don't see what's the problem with the new > syntax here. This: >
You're right, my example didn't suffer from the diamond inheritance problem. But suppose you want to inherit from a QWidget derived class (or any of the QObject derived classes in Qt xD) in addition to the signals/slots interface: if the interface itself derives from QObject, you'd have diamond inheritance. > QObject * a = new A; > QObject * b = new B; > QObject::connect(a, A::someSignal, b, B::someSlot); > > should be working just fine. > Yes it works, but you're no longer using an interface when you mention A or B [in the connect statement]. > Plus I don't see a reason for the asQObject() method, qobject_cast or > dynamic_cast would be much simpler and cleaner. > Interface doesn't inherit from QObject, so qobject_cast doesn't work. I don't compile with RTTI, so dynamic_cast is out. PS. > I just realized you're worried that the functions are virtual. Well this is > of no consequence, the vtable is respected (if I remember correctly that's > specified in the standard). So the following should also be working without > any problem: > > QObject::connect(a, Interface::someSignal, b, Interface::someSlot); > That does not compile. (even with the missing ampersands added it still doesn't :-P) d3fault
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest