class Controller : public QObject
{
Q_OBJECT
private:
Two objTwo;
QThread objQThread;
Controller();
public slots:
void mySlot(){}
};
Controller::Controller()
{
objTwo.moveToThread( &objQThread );
connect( &objTwo, &Two::emitThisSignal, this, &Controller::mySlot );
connect( &objQThread, &QThread::finished, &objQThread, &QThread::deleteLater );
objQThread.start();
}
Here the QThread's object is not a pointer, so will it still be required to use deleteLater
here?
Is it appropriate to use class objects there instead of pointers?
I thought deletion can be prevented that way.
Here the QThread's object is not a pointer, so will it still be required to use
deleteLater
here?
No.
Is it appropriate to use class objects there instead of pointers?
Totally, don't use pointers if you don't need to.
I thought deletion can be prevented that way.
Manual deletion can be prevented this way, yes.