[Qt-interest] static function emitting signal

Gabriel M. Beddingfield gabrbedd at gmail.com
Thu Mar 25 04:59:00 CET 2010


Hi Chandru,

On Thu, 25 Mar 2010, Chandru... wrote:

> its not working or i dont know how to use your siggestion ...

What about it is not working?

> see my call back function
> void
> QtFpsThread::UserCallBack(FTR_USER_CTX Context,FTR_STATE
> StateMask,FTR_RESPONSE *pResponse,FTR_SIGNAL Signal,FTR_BITMAP_PTR pBitmap)
> //static function
> {
>   LPBIOPERPARAMS   lpboc = (LPBIOPERPARAMS)Context;            // biometric

It looks to me like "FTR_USER_CTX Context" is the same as 
the "void* arg" that I mentioned.  So, I would expect to see 
something like:

     void
     QtFpsThread::UserCallback(FTR_USR_CTX Context, ...)
     // static function
     {
         QtFpsThread *instance;
         instance = static_cast<QtFpsThread*>(Context);
         instance->a_non_static_member_function(
               StateMask, pResponse, Signal, pBitmap
               );
     }

Does that make sense?

Also, with respect to static_cast<> vs. 
reinterpret_cast<>... in this case they do the same thing 
because you're casting from void* (an anonymous pointer). 
However, static_cast<> is generally safer to use... since 
reinterpret_cast<> means, "Obey me, you simpleton compiler! 
I /know/ what I'm doing."

-gabriel




More information about the Qt-interest-old mailing list