Add QHandleManager template and test

With: Paul Lemire

Change-Id: Id269fd051a6a6b4f23a733c8123f11bb63e80aa7
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>