For ex. I got:
“wrapper.h”
class wrapper : public QWidget
{
Q_OBJECT
public:
Wrapped_class m_class;
private:
QTimer* m_timer;
}
“Wrapped_class.h”
class Wrapped_class
{
public:
Wrapped_class();
public slots:
f(); // slot which is called when m_timer send signal timeout()
}
“Wrapped_class.cpp”
Wrapped_class::Wrapped_class()
{
QOBject::connect(wrapper::m_timer, SIGNAL(timeout()), this, SLOT( f()))
}
I get error that wrapper::m_timer in not accessible
You need a
pointerorreferenceto the class to access it’snon staticmembers. Pass apointerto the wrapped class when it’s being wrappedadd something like this to your
Wrapped_class:and call this function when the object is being wrapped. Initialize
m_rappertonullptrin constructor