Direct and indirect pieces of observational evidence point to a strong connection between high-redshift quasars and their host galaxies. In the framework of a model where the shining of the quasar is the episode that stops the formation of the galactic spheroid inside a virialized halo, it has been proven possible to explain the submillimetre source counts together with their related statistics and the local luminosity function of spheroidal galaxies. The time delay between the virialization and the quasar manifestation required to fit the counts is short and incresing with decresing the host galaxy mass. In this paper we compute the detailed chemical evolution of gas and stars inside virialized haloes in the framework of the same model, taking into account the combined effects of cooling and stellar feedback. Under the assumption of negligible angular momentum, we are able to reproduce the main observed chemical properties of local ellipticals. In particular, by using the same duration of the bursts which are required in order to fit the submillimetre source counts, we recover the observed increase of the Mg/Fe ratio with galactic mass. Since for the most massive objects the assumed duration of the burst is Tburst < 0.6 Gyr, we end up with a picture for elliptical galaxy formation in which massive spheroids complete their assembly at early times, thus resembling a monolithic collapse, whereas smaller galaxies are allowed for a more prolonged star formation, thus allowing for a more complicated evolutionary history. In the framework of the adopted scenario, only quasar activity can provide energies large enough to stop the star formation very soon after virialization in the most massive galactic haloes. The chemical abundance of the gas that we estimate at the end of the burst matches well the metallicity inferred from the quasar spectra. Therefore, the assumption that quasar activity interrupts the main episode of star formation in elliptical galaxies turns out to be quite reasonable. In this scenario, we also point out that non-dusty extremely red objects are the best targets for searching for high-redshift Type Ia supernovae.