Cadaqués enjoys a Mediterranean climate, with cool winters and hot summers. If you are after sun, the best times to go are May, June, July, August and September. The heat is at its stongest in July and August, with highs in the 30s (Celsius). However, its proximity to the Med keeps the serious heat of the south of Spain away.
Also, remember that you are very close to The Pyrenees here, which does make for some unique local weather systems. During the winter the Tramuntana can be severe, and may make you uncomfortable, although if you like your environment wild and rugged, this could be a good time to go! The scenery is certainly impressive when the wind blows.