Replace deprecated method when building with Qt 5