Quality factors of deformed dielectric cavities