Barcelona is a city with many things to do if it rains or if it doesn't, there are amazing buildings to visit such as modernist ones like Gaudí's for example and art nouveau buildings, beautiful parks such as Park Güell, shopping for all budgets from high end to bargains etc...
Barcelona though, changes when it rains, locals are not used to the rain, luckily we don't get much of it, so it might seem that everybody is hiding when it rains and you are the only person in town.
Don't get scared though! It is normal, as locals we find the perfect excuse to be at home with our blanket when it rains and even if you had plans to meet with someone they might get cancelled due to the rain. You might think this is very stupid but it is true, is the feeling of the weather, imagine that in London they had to cancel everything because of the rain? The streets would look like those in Walking dead every day of the year.
Having said that, there are plenty of things to do when it rains, I will share my local tips and you will take the most of the deserted streets in Barcelona when it rains:
Hot Chocolate at Petritxol street
This is a classic, when it rains, the temperature drops and what is best than a hot chocolate. If you fancy a hot chocolate or a hot cacaolat -a chocolate milkshake typical brand from Catalonia-, it is your chance to make it happen. The best street in Barcelona for a sweet breakfast or an afternoon snack is with no doubt carrer Petritxol with its century old cafeterias that offer the best hot chocolate in town.
If it rains it might be the perfect time to go shopping, you can choose many shopping centres in Barcelona most of them are covered so you will be safe from the rain. It would be a good occasion to think about buying souvenirs for your family and friend or buy food for gourmets to bring home, a typical food from the place you visited is always a safe bet to let everyone try it when you are back home!
Visit a Museum
Getting into a museum it is perfect when it rains as it is a covered space so you won't get wet, you can leave your belongings, the umbrella included in the cloakroom so you don't need to go around with all your stuff. Barcelona is full of interesting museums, if you are into art, I would recommend you the Picasso museum, the MACBA and the CCCB.