Until now snippets were inserted in a snippet file where each fragment of code was surrounded by (mostly) numeric tags. Invoking them was done by making a \snippet command followed by the path to the snippet file and the tag of the code you wanted to quote.
That snippet file was mostly a cpp or qml file. Snippets can contain syntax errors or typos. They are not supposed to pass the review phase, but if they do those errors will not be picked up by the CI. Making the snippets compilable will avoid that. This is however not possible for snippets in qml since qml at the present time is not compilable.
Making snippets compilable also means that you have to insert code that is only there to in order to have the snippet compilable. Code that is not quoted anywhere, and does not really have a functional meaning. Sometimes even «typedef void» statements, just to get the snippet code compilable. It also means that sometimes a snippet file has to be split up. Some snippet code is really not compilable. The snippet might be very succinct (cf infra), or might involve compiling libraries that maybe will not be compilable on some platforms.
This has already been done for QtWidgets, QtSql, QtTest, QtQuickTest and Qt Network.
One limitation is that we only planned to have snippets compilable for syntax or naming checking. I did no further testing of the executable. In Qt 6 qml will be compilable, which will allow us to use the same snippet checking system for qml.