If you have problems scanning the QR code when setting up two-factor authentication, you can instead request a code that you will then have to enter in your authentication app in lieu of the QR code.
If you are setting up two-factor authentication on your smartphone and using it to display the QR code, you cannot simultaneously scan the code with the authentication app.
When you are setting up two-factor authentication on your computer, you may sometimes be unable to scan the QR code with your smartphone, e.g. due to poor camera resolution or other errors.