If you don't want to declare MYVARIABLEin your class, but are tied to this particular signal / slot connection instead, you can connect the signal to lambda C ++ 11 using Qt5's new single, singal / slot , and then call your slot using lambda.
For example, you can write:
QTimer * timer = new QTimer();
connect(timer, &QTimer::timeout, [=]() {
method(MYVARIABLE);
});
timer->start(4000);
, ++ 11 Qt5, Qt Property System, QTimer*. QObject::setProperty().
QObject::sender(), QTimer* , QObject::property().
, .