Don't remove direct Qt's and std's includes
Hi, I’m working on the engine for displaying, playing and manipulating the score in the official MoseScore mobile application, and development a new feature for the editor.
Therefore, I work with the MoseScore code everyday, and I have an important issue for me.
For development, I use the QtCreator, it’s a very cool and powerful IDE.
To help develop, the QtCreator build a code model, and due to this model they work correctly:
- code highlighting
- auto completion
- code jump
- code using
- and other
In order for a QtCreator to build a code model, he needs to have information about the types used, which is provided using inclusions of these types (including standard Qt and std).
There is an IDE, for example VS Code, which work due to parsing syntax and search, so they don’t need a code model, they don’t need icludes, but they do not allow the correct implementation of a number of possibilities (jump, rename, etc.)
MoseScore uses a header precompiler to speed up build, which is good.
But it is customary to remove direct includes Qt and std (for example https://github.com/musescore/MuseScore/pull/5704, https://github.com/musescore/MuseScore/pull/5692) , and therefore the QtCreator cannot build a code model, and this is a problem for me.
Direct inclusion of types used in the file does not interfere with working with precompiled headers and does not affect the build speed. They are not inserted by the preprocessor because they are actually already inserted by precompiled header (the insert is protected by a guard). Аt the same time, gives a lot of benefits, which may or may not be used.
Also, the direct inclusion of headers gives an understanding of the organization of the code structure. For example, if in a class like Chord, if there is something like QNetworkAccessManager, or QMessageBox, etc., it means something went wrong.
Without the direct inclusion of headers, it is more difficult to see the incorrect structure of the code, because you cannot see what the class really depends on, especially if it is very large (2000-3000 and more lines of code).
Can we change the approach, and don't remove the direct inclusion of the headers Qt and std?