I made it work by removing this flag: Qt::WindowDoesNotAcceptFocus