We carry out a study of the hardness of the radiation of ionizing clusters in H ii regions. First, we explore the applicability of the softness parameter eta, originally defined in the optical for pairs of consecutive ionization stages of the same species. With the advent of the infrared space observatories, this definition has been extended to the mid-infrared. We show that the softness parameters, as determined in both the optical and the mid-infrared wavelengths, are sensitive to the effective temperature using a sample of data in both spectral regimes. This is confirmed by comparing the data with a grid of photoionization models, although no complete agreement has been found even for different stellar model atmospheres. Finally, we show that both softness parameters are consistent in the search for radial variations of the hardness of the ionizing radiation of H ii regions in the discs of spiral galaxies. We find a range of trends, from galaxies showing pronounced gradients to those showing very flat ones. Although the detectability and slope of these gradients can be altered by the size and luminosity of the studied H ii regions, it looks that their existence is related to the mass and type of the galaxies and, hence, to the properties of the entire disc.