  Heavy-atom alkaline earth monofluoride molecules are considered as
prospective systems to study spatial parity or spatial parity and time-reversal
symmetry violating effects such as the nuclear anapole moment or the electron
electric dipole moment. Comprehensive and highly accurate theoretical study of
the electronic structure properties and transition energies in such systems can
simplify the preparation and interpretation of the experiments. However, almost
no attempts to calculate quantum electrodynamics (QED) effects contribution
into characteristics of neutral heavy-atom molecules have been performed.
Recently, we have formulated and implemented such an approach to calculate QED
contributions to transition energies of molecules [L.V.~Skripnikov, J. Chem.
Phys. \textbf{154}, 201101 (2021)]. In this paper, we perform a benchmark
theoretical study of the transition energies in the Ba$^+$ cation and BaF
molecule. The deviation of the calculated values from the experimental ones is
of the order 10 cm$^{-1}$ and is more than an order of magnitude better than
the "chemical accuracy", 350 cm$^{-1}$. The achievement of such an agreement
has been provided in particular by the inclusion of the QED effects. The latter
appeared to be not less important than the high-order correlation effects
beyond the coupled cluster with single, double, and perturbative triple cluster
amplitudes level. We compare the role of QED effects for transition energies
with heavier molecules -- RaF and E120F, where E120 is the superheavy Z=120
homolog of Ra.
