I think you can create an auxiliary class which will have your function and yhis function will be declared as a slot. In this case your connect statement will be valid.

But in general, I think this is not a normal situation and i think you need to review your application's design.