c++qtpointersqscopedpointer

QScopedPointer with signals and slots


as the tittle says, i could not find any relationship or how to pass them to signals and slots.

Anyone could give me a quick tutorial? or Introduction? :)


Solution

  • You have to get an QObject-derived class object from the QScopedPointer by QScopedPointer::data() method and use it:

    QScopedPointer<QThread> p(new QThread);
    connect(p.data(), SIGNAL(finished()), SLOT(onThreadFinish()));
    

    QScopedPointer class reference