C++ (Qt)void MyClass::run(){ this->signalMapper = new QSignalMapper(); ... this->addNewTimer();} void MyClass::addNewTimer(){ QTimer* timer = new QTimer(); QObject::connect(timer, SIGNAL(timeout()), this->signalMapper, SLOT(map())); this->signalMapper->setMapping(timer, timer);}
C++ (Qt)void myClass::delTimer(QObject* timer){// timer->moveToThread(this);// timer->setParent(0);// timer->moveToThread(this->thread());// delete timer;}
C++ (Qt)void myClass::delTimer(QObject* timer){ qDebug() << "text"; timer->deleteLater();}
C++ (Qt)void myClass::delTimer(QObject* timer){ timer->moveToThread(this); delete timer;}
C++ (Qt)void myClass::delTimer(QObject* timer){ timer->moveToThread(this->thread()); delete timer;}
C++ (Qt)this->addNewTimer();
C++ (Qt)void MyClass::run(){ this->signalMapper = new QSignalMapper(); ... QTimer* timer = new QTimer(); QObject::connect(timer, SIGNAL(timeout()), this->signalMapper, SLOT(map())); this->signalMapper->setMapping(timer, timer);}