Dev touch2mouse

This is a cherry pick from the Qt dev branch, fixing various touch/mouse issues.