kartun
28th February 2011, 12:25
May be it was answered already, but I can't find a proper solution.
1. I've base class. It does most of the work
2. I've child classes that do more specific tasks
class abstract_therapy : public QObject
{
Q_OBJECT
...
public:
void testFunction();
public slots:
void testSlot();
private:
QTimer* m1;
}
Child class :
class B : public abstract_therapy
{
Q_OBJECT
...
}
And implementation
void abstract_therapy::testFunction()
{
m1 = new QTimer(this);
m1->connect(m1, SIGNAL(timeout()), this, SLOT(testSlot()));
m1->setInterval(500);
m1->start();
}
In the program I've several classes inherited from abstract_therapy, B & C for example, and I don't use base class directly.
abstract_therapy* _therapy;
_therapy = new B;
...
_therapy->testFunction();
And on connect I receive this message :
No such slot B::testSlot()
What's the right way to connect ?
1. I've base class. It does most of the work
2. I've child classes that do more specific tasks
class abstract_therapy : public QObject
{
Q_OBJECT
...
public:
void testFunction();
public slots:
void testSlot();
private:
QTimer* m1;
}
Child class :
class B : public abstract_therapy
{
Q_OBJECT
...
}
And implementation
void abstract_therapy::testFunction()
{
m1 = new QTimer(this);
m1->connect(m1, SIGNAL(timeout()), this, SLOT(testSlot()));
m1->setInterval(500);
m1->start();
}
In the program I've several classes inherited from abstract_therapy, B & C for example, and I don't use base class directly.
abstract_therapy* _therapy;
_therapy = new B;
...
_therapy->testFunction();
And on connect I receive this message :
No such slot B::testSlot()
What's the right way to connect ?