make it compile on Qt5 + other changes and improvements