are you able to use midRef/QStringRef here to avoid a copy? (given you copy again using toLatin1 below)