Qt 5 port + memory leak reduction

This update changes the framework to Qt5. It also fixes memory leaks and a segmentation fault.
If you think you have found a memory leak, use valgrind with suppression files for qt or use valgrind from qt creator (it is configured to ignore the qt false erors).