We present a unified variational treatment of the electric quadrupole (E2) matrix elements, Einstein coefficients, and line strengths for general open-shell diatomic molecules in the general purpose diatomic code Duo. Transformation relations between the Cartesian representation (typically used in electronic structure calculations) to the tensorial representation (required for spectroscopic applications) of the electric quadrupole moment components are derived. The implementation has been validated against accurate theoretical calculations and experimental measurements of quadrupole intensities of 1 H 2 available in the literature. We also present accurate electronic structure calculations of the electric quadrupole moment functions for the X 1 Σ + electronic states of CO and HF at the CCSD(T) and MRCI levels of theory, respectively, as well for the a 1 ∆ g -b 1 Σ + g quadrupole transition moment of O 2 with MRCI level of theory. Accurate infrared E2 line lists for 12 C 16 O and 1 H 19 F are provided. A demonstration of spectroscopic applications is presented by simulating E2 spectra for 12 C 16 O, H 19 F and 16 O 2 (Noxon a 1 ∆ g -b 1 Σ + g band).