I have been looking into this myself, with no conclusive information on how to reliably accomplish this. It feels like Qt 5.6 ought to automagically do the scaling for you; I intend to post a new question in this forum asking about this. In the meanwhile, the first part of this video will be of interest to you:
@RDiGuida To add to @Mario84's answer, QString is Qt based class and your using standard c++ API's to print it which it doesnot understand. To print values of pure Qt based API's you can use qDebug().