jmorris got the useful details. QR is just one of MANY 2D barcode standards. They have existed since the 1960s, and were widely implemented on things like railcars (though it was a bit early, and color was a terrible idea so they abandoned that system a few decades later).
There's a pretty big gap between human-readable labels and machine-readable info, and if you rely on human-readable tracking IDs during manufacturing — like hand-scribed assembly numbers you may have on some vintage guns — then there's a delay to enter it, and transcription errors. If you attach a tag it can fall off. If they go in a tracked bin, those can spill and you mostly need to remove from the bin to do the work then be sure they go back in the RIGHT bin. Errors and mistakes can always occur (Yes, I work on some related stuff, have been in factories and seen process control systems, seen these issues myself to design stuff to help them).
Machine-read barcodes are common on manufactured parts for a couple decades now, especially when they have to be assembled, and there are tolerances, variations, or compliance needs. Some are stickers, or plates, and some get removed (sometimes inexplicable-to-you slots, grooves, and holes are for in-factory fixturing or tagging). These, you'll note, are deep, so work on bare metal AND after finishing. I suspect they are put in there right away, as or with the first step out of the forge so they can be tracked through their entire life in the factory. I also bet there are similar codes on other major components. Back of the cylinder? Under the crane?
To those insisting they are ugly: it's very much what we're used to. To my sense of clean desdeign: there's a big flat-head screw visible right next to the barcode. I know This Is The Way, but I've never gotten used to visible screws (yes, had a couple guns with no screws, and all detents and hidden pins, can be done!) so the Classic Revolver looks very halfassed to my senses. In 40 years there will be people who hate something like the /new/ barcodes because they grew up with a couple guns with this machine code and the new ones are "ugly."