Is there any way to set the default parse context in Qt Creator?
-
I'm working on a project with four different subprojects, one of which only includes Qt Core and barely any of my header files. Unfortunately it's the one that is always chosen by default to be the parse context for every single one of my source files! This makes nearly every feature for highlighting and following symbols break until I manually change the parse context to the right subproject. I have hundreds of source files, so this is constantly bugging me.
Is there a way I can specify that a different subproject be the default parse context for my project?
Update: After doing some experimenting, I've found that it doesn't seem to be choosing a subproject based on its name. I can't figure out what the logic is! I do hope there is a way to do this because it's been driving me crazy.
-
If there are multiple parse contexts for a file, a combo box will show up on top of code editor panel (near where you can select line endings etc.). You can switch it there but it's a manual, file-by-file process.
-
Well since this was driving me crazy, I went ahead and took a look at Qt Creator's source code to see how it decided what the parse context will be if a preferred one isn't set. I found is that there's a somewhat complex process for determining which parse context to pick, where each choice is weighted by a number of factors.
What isn't considered though is the currently selected build target. Given a choice between equally weighted parse contexts, it makes sense that Qt Creator should pick the parse context that comes from the current build target. If it did that, then it would nearly always make the right choice for me, since very often a single source file is included in several targets, and I want the context to be whatever I'm building.
I might submit a patch for Qt Creator that fixes this behavior.