If I understand your problem you want your pointer to act like a decorator for your instance of QObject. No matter what's called on the object you want the code to go through the operator overloading of the pointer first to synchronize the call and then delegate the execution to the object.
Let me be honest, there's no such a thing in C++ (I'm talking about decorators).
But it doesn't mean it's not possible with Qt. The problem is that you connect the signal to your object, so the compiler has no idea about the SynchronizedPointer that's taking care of it.
What should be done is connecting the signal to the SynchronizedPointer instead, then delegate the execution to the encapsulated object's slot when the pointer receives the signal. You probably need to look deeper into Qt's meta objects and reflection documentation to come out with a generic solution but if that's not possible then you would need to write one pointer class for each type you want to decorate (not very exciting).
PS : If the sexy solution works try writing a generic Decorator class, that would be awesome.
Bookmarks