Quaternion to orientation

I’m trying to make a virtual trackball for better visualisation in blender game and struggling to convert, or apply, Quaternion value to GameObject’s orientation. If this is not possible or doesn’t make sense, is there any better way to implement a virtual trackball in blender game engine? Many thanks