this could be cleaned up to not create so many QStrings... maybe make the last param be a QString& and treat it as an out param. Or if you really want it to return a QString then at least make the input QString a const QString& so we avoid an extra copy there.