Enable -DQT_NO_CAST_TO_ASCII and fix compilation with it

Authored by dfaure on Nov 14 2017, 8:09 AM.