Support building with Qt 5 if USE_QT5 is enabled

MD-19537