c++ - Cannot connect signal from base class -
when try connect base class signal, qt tells me signal not exists on derived class.
why that? how can tell connect use base class?
namespace mynamespace { void register(derived* derived) { // error msg // qobject::connect: no such signal mynamespace::derived::basesignal() qobject::connect( derived, signal(basesignal()), foo, slot(fooslot())); } class base : public qobject { q_object signals: void basesignal(); }; class derived : public qobject, public base { q_object signals: void derivedsignal(); }; } // namespace mynamespace
it better in form:
namespace mynamespace { class base : public qobject { q_object signals: void basesignal(); }; class derived : public base { q_object signals: void derivedsignal(); }; void registerx( derived* derived ) { qobject::connect( derived, signal(basesignal()), foo, slot(fooslot())); } } // namespace mynamespace
as this post says shall not inherit qobject multiple times.
Comments
Post a Comment