of course,the following is code.but i still cannot decalre the static variable in class scope,when i do it ,the VC7 always report various error.either not define the variable or cannot be interped by metaobject.
Qt Code:
  1. ///////////////////////storescpThread.h
  2. typedef (*STORESCPCALLBACK)(void *callbackData, char* statusDetail);
  3. static unsigned long classAddress;
  4. class storescpThread:public QThread
  5. {
  6. Q_OBJECT
  7. public:
  8. storescpThread(QTextEdit *txtEdit,QObject *parent = 0)
  9. ~storescpThread();
  10. protected:
  11. void run();
  12. static void emitMsg( unsigned long user_value,char * filename)
  13. {
  14. storescpThread* pthis = (storescpThread*)user_value; //
  15. pthis->setText(state,filename);
  16. }
  17. void mycallback();
  18. private :
  19. QTextEdit * textEdit;
  20. static void storeSCPCallback(void *callbackData, char* statusDetail);
  21. void setText(char * state,char * name);
  22. };
  23.  
  24. ///////////////////////storeScpThread.cpp
  25. storescpThread::storescpThread(QTextEdit *txtEdit,QObject *parent): QThread(parent)
  26. {
  27. textEdit=txtEdit;
  28. classAddress =(unsigned long)this ;
  29. }
  30. void storescpThread:: storeSCPCallback(void *callbackData, char* statusDetail)
  31. {
  32. emitMsg(classAddress,statusDetail);
  33. return ;
  34. }
  35. void storescpThread::mycallback()
  36. {
  37. myThirdCallFunction(storeSCPCallback); //the third party function, which used callback as param
  38.  
  39. }
To copy to clipboard, switch view to plain text mode