Oh yes you got it wrong.
If I understand your problem, you have a base class say A, and there are different derived classes from it each wanting to connect to a common signal from base object but do derived class specific slot.
Will this example work?
//a.h
Class A
{
public:
}
//a.cpp
#include "a.h"
//b.h
Class B : public A
{
}
//b.cpp
#include "b.h"
B::B() : A() {
QObject::connect(timer,
SIGNAL(timeout
()), object,
SLOT(object_slot
()));
}
//a.h
Class A
{
public:
static QTimer *timer;
}
//a.cpp
#include "a.h"
QTimer * A::timer = new QTimer(0);
//b.h
Class B : public A
{
}
//b.cpp
#include "b.h"
B::B() : A() {
QObject::connect(timer, SIGNAL(timeout()), object, SLOT(object_slot()));
}
To copy to clipboard, switch view to plain text mode
Anyway this is just a basic C++ problem, nothing to do with Qt, you better read more about C++ static class members.
Bookmarks