QtCreator: IntelliSense



  • Hi

    in addition to C++ development, I'm using QtC to edit some C-like scripts.
    these are completely like C code just use not all advanced language features
    and also have a built-in API.
    So, the question is :
    e.g. I'm writing a script like

    @void main() {
    print("bla-bla-bla");
    Table* t;
    t = DB_ExecSql("select * from table where ...");
    DB_ShowTable(t);
    DB_DestroyTable(t);
    }@

    looks like a usual C code,
    and QtC highlights the syntax and builds the structure of variables, functions etc

    however this script uses a lot of functions built into script engine, e.g. DB_ExecSql above.
    I have a header file with prototypes of all these functions but can't add the include at the beginning of the source file like:
    #include "api.h"
    in this case the script won't work correctly. seems like a script engine does this inclusion by itself before execution.

    Is there way , in QtC , to use a headers included into the project but not included into source, to use a definitions from there for parameters tips , navigation etc?
    In Eclipse, was enough to add the headers to project and C parser in IDE used all available prototypes to perform syntax checking



  • In the main toolbar of an editor there's a button labeled with a hash mark ("#"). If you click that, you get a texteditor where you can enter extra code that won't be compiled, but interpreted as normal additional C(++) code for this file, including interpretation of preprocessor directive. You should be able to use that to tweak the code model's view of the world to your liking.



  • thank you for the idea
    however looks it doesn't work for me

    if I'm adding the line
    #include "my_api.h"
    to file directly it works fine - all types and functions are highlighted and intellisense also works fine with tips for parameters
    but if I'm moving this line to the box of additional preprocessing code
    nothing works

    I suppose that way works for compile time only, right?
    and doens't affect code model at edit time?

    or i'm doing something wrong...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.