[Qt-interest] Connecting slots to virtual objects
Dirk Neumann
dirk.neumann at dn-informatik.de
Fri Jul 2 12:59:50 CEST 2010
Hello,
is there a way to connect to signals of objects which are only
accessible via a pure virtual method? The layout is the following:
class A : public QObject{
...
signals:
void mySignal();
...
};
class A1: public A{
...
};
class A2: public A{
...
};
class B{
...
protected:
virtual A* myA()=0;
...
};
class B1 : public B{
...
A1* _a;
protected:
A myA(){return _a;}
...
};
class B2: public B{
...
A2* _a;
protected:
A myA(){return _a;}
...
};
Now I want to connect to mySignal() inside the constructor of B. An
expression like
>connect(myA(),SIGNAL(mySignal()),this,SLOT(onMySignal()));
inside the constructor of B results in a linker error of type
>undefined reference to `B::myA()
expressing myA()->method() compiles and links without problems.
Thanks in advance
Dirk.
--
Dirk Neumann - Informatik
Dipl.-Inf. Dirk Neumann
Plauenscher Ring 26
D-01187 Dresden
Mob.: 0163/8191896
E-Mail: dirk.neumann at dn-informatik.de
Web: www.dn-informatik.de
Strnr: 203/252/10479
More information about the Qt-interest-old
mailing list