A theoretical calculation is presented for the effect of homogeneous broadening of optical gain on lasing spectra of quantum-dot lasers. Based on a coupled set of rate equations considering both the size distribution of quantum dots and a series of longitudinal cavity modes, we show that dots with different energies start lasing independently due to their spatial localization when the gain spectrum is a delta-like function, and that the dot ensemble contributes to a narrow-line lasing collectively under large homogeneous broadening. The result explains quite excellently the experimental lasing spectra found in self-assembled InGaAs-GaAs quantum-dot lasers.