Do I need to have held the same visa throughout the qualifying period?

No. Different periods of lawful immigration permission may count towards Long Residence, provided the relevant Immigration Rules are satisfied.