We should eliminate as many hard-coded snippets, and use \quotefromfile or \snippet commands instead to quote code from actual, working code. This will also help in porting the code from C++ to Python (for PySide).
The purpose is to ensure that the snippets represent real use of the API, and that API changes do not invalidate the snippets. See Qt Bluetooth for an example of how this can be achieved. This needs to be run in CI, perhaps only on Linux. Compile only, no auto-tests.