ported to Qt 5, checked on OSX