Qt5 compatibility

"Backward compatibility with Qt4 is retained."
Thanks to https://github.com/canercandan
Similar to https://github.com/bitcoin/bitcoin/pull/2721