1

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? :)

1 Answers1

3

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

VP.
  • 15,509
  • 17
  • 91
  • 161
  • well now i am getting this error code QWidget: Must construct a QApplication before a Qwidget. I might know where the problem is. Related to that, can i create global QScoped Pointer? – Alexander Baťka Aug 13 '15 at 13:02
  • 2
    @AlexanderBafka: You cannot create static/global QPixmap/QWidget instances, as they require a QApplication to be constructed before. That’s unrelated to QScopedPointers though and would also happen with a raw pointer. – Frank Osterfeld Aug 13 '15 at 16:18
  • Global instances should be created with `Q_GLOBAL_STATIC`: they are created in a thread-safe manner, and are instantiated on the first use - after `QApplication` is alive and well. – Kuba hasn't forgotten Monica Aug 13 '15 at 21:35