QPR ensured it was an unhappy return to Loftus Road for Steve McClaren by beating Derby 2-1 to close the gap on Sky Bet Championship leaders Burnley.