Get rid of tr1/functional

This header requires rtti in libstdc++ on Mac, which we can't recommend
since Qt itself is usually built without rtti.

Replace its uses with simpler hand-made template functors.

Change-Id: Ic020dcceaf262f77d92b31a8318a513fa200428d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>