  We continue our comprehensive theoretical investigation of the spectral
evolution of white dwarfs based on sophisticated simulations of element
transport. In this paper, we focus on the transformation of PG 1159 stars into
DO/DB white dwarfs due to the gravitational settling of heavy elements, and
then into DQ white dwarfs through the convective dredge-up of carbon. We study
the impact of several physical parameters on the evolution of the surface
carbon abundance over a wide range of effective temperature. In the hot PG 1159
and DO phases, our calculations confirm that the temperature of the PG
1159-to-DO transition depends sensitively on the stellar mass and the wind
mass-loss rate. We show that measured carbon abundances of DOZ white dwarfs are
mostly accounted for by our models, with the notable exception of the coolest
DOZ stars. In the cooler DB and DQ phases, the predicted atmospheric
composition is strongly influenced by the stellar mass, the thickness of the
envelope, the initial carbon content, the efficiency of convective overshoot,
and the presence of residual hydrogen. We demonstrate that, under reasonable
assumptions, our simulations reproduce very well the observed carbon abundance
pattern of DQ stars, which thus allows us to constrain the extent of the
overshoot region in cool helium-rich white dwarfs. We also argue that our
calculations naturally explain a number of recent empirical results, such as
the relative excess of low-mass DQ stars and the presence of trace hydrogen
and/or carbon at the surface of most DC and DZ stars.
