Cleanup opaque pointer use and make it more ridgid by using qt macros