Patched to compile with Qt5