Fix build with deprecated API disabled

2 jobs for master
Status Name Job ID Coverage
  Build
canceled build_clazy_clang_tidy #113037

canceled linux kf5-qt5 qt5.15 #113036