Qt5 support

This is based on VanNostrand's initial qt5 port; compiles and run fine on - at least - osx.
Same here, encapsulate this block to a function if possible