Port to Qt5 and two fixes.

* It now compiles under Qt5 (tested on windows). 
* One major fix and one small fix.