template <class ObjT, class Parm1T, class RetT = void>class ThreadRun : public QThread{public: ThreadRun(ObjT *object, RetT (ObjT::*function)(Parm1T), Parm1T parm ,QObject *parent = NULL ) : QThread(parent), object_(object), function_(function), parm_(parm){} ~ThreadRun(){if(isRunning())this->wait();} void run(){retval_ = (object_->*function_)(parm_);} RetT & retval() {return retval_;} void msleep( unsigned long msecs ) {QThread::msleep( msecs ); }private: ObjT *object_; RetT (ObjT::*function_)(Parm1T); Parm1T parm_; RetT retval_;};
ThreadRun < MyWidget, QString, QString > * s_s_Thread = qobject_cast < ThreadRun < MyWidget, QString, QString > * > ( sender() );
void *XButtonPrototype::qt_metacast(const char *_clname){ if (!_clname) return 0; if (!strcmp(_clname, qt_meta_stringdata_XButtonPrototype)) return static_cast<void*>(const_cast< XButtonPrototype*>(this)); if (!strcmp(_clname, "QScriptable")) return static_cast< QScriptable*>(const_cast< XButtonPrototype*>(this)); return QObject::qt_metacast(_clname);}
template <class T>inline T qobject_cast(const QObject *object){#if !defined(QT_NO_MEMBER_TEMPLATES) && !defined(QT_NO_QOBJECT_CHECK) reinterpret_cast<T>(0)->qt_check_for_QOBJECT_macro(*reinterpret_cast<T>(object));#endif return static_cast<T>(const_cast<const QObject *>(reinterpret_cast<T>(0)->staticMetaObject.cast(const_cast<QObject *>(object))));}
struct GenericClosure { void run() = 0};template <class ObjT, class Parm1T, class RetT = void>struct ConcretClosure : GenericClosure { ConcretFunc(ObjT *object, RetT (ObjT::*function)(Parm1T), Parm1T parm): object_(object), function_(function), parm_(parm){} void run() {object_->*function_)(parm_);} RetT & retval() {return retval_;} private: ObjT *object_; RetT (ObjT::*function_)(Parm1T); Parm1T parm_; RetT retval_;};class ThreadRun : public QThread{public: ThreadRun(GenericClosure* closure, *parent = NULL ) : QThread(parent), closure_(closure) {} ~ThreadRun(){if(isRunning())this->wait();} void run() {closure_->run();} GenericClosure* closure() {return closure_;} void msleep( unsigned long msecs ) {QThread::msleep( msecs ); }private: GenericClosure* closure_;};
assert(dynamic_cast<ThreadRun < MyWidget, QString, QString > *>(sender()));ThreadRun < MyWidget, QString, QString > * s_s_Thread = static_cast < ThreadRun < MyWidget, QString, QString > * > ( sender() );