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:
}
class abstract_therapy : public QObject
{
Q_OBJECT
...
public:
void testFunction();
public slots:
void testSlot();
private:
QTimer* m1;
}
To copy to clipboard, switch view to plain text mode
Child class :
class B : public abstract_therapy
{
Q_OBJECT
...
}
class B : public abstract_therapy
{
Q_OBJECT
...
}
To copy to clipboard, switch view to plain text mode
And implementation
void abstract_therapy::testFunction()
{
m1->connect(m1, SIGNAL(timeout()), this, SLOT(testSlot()));
m1->setInterval(500);
m1->start();
}
void abstract_therapy::testFunction()
{
m1 = new QTimer(this);
m1->connect(m1, SIGNAL(timeout()), this, SLOT(testSlot()));
m1->setInterval(500);
m1->start();
}
To copy to clipboard, switch view to plain text mode
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();
abstract_therapy* _therapy;
_therapy = new B;
...
_therapy->testFunction();
To copy to clipboard, switch view to plain text mode
And on connect I receive this message :
No such slot B::testSlot()
What's the right way to connect ?
Bookmarks