QImageReader::quality() returns either -1 or the value set with QImageReader::setQuality(), but never reads the value from the image handler and thus it doesn't get the value from the image file. The quality is image's (or encoder's) feature and not something the user sets when reading the file. Thus I think the logic is flawed.
Find attached a test app (incl. jpeg file), which prints the image format, size and quality to the debug output.