Ported to Qt 5. Issue #16