Queens Park Rangers have announced they have reached an agreement with Real Madrid for the permanent transfer of midfielder Esteban Granero.