Rory McIlroy put aside the anguish in his private life to win the European Tour's flagship BMW PGA Championship on Sunday.