Theory of the lineshape of quantum well intersubband transitions: optical dephasing and light propagation effects