Qt5-ized the code.

I still maintain compatibility with Qt4. Search for `#if QT_VERSION` and
`QT_VERSION_CHECK(5, 0, 0)` for places that I've customized the
compatibility.
But in the next commits i'm gonna use Qt's JSON module and this
compatibility will vanish.