Important: Please read the Qt Code of Conduct -

Qt Creator auto-complete doesn't recommend anything from the files that haven't been included

  • Hello world,

    it would be really helpful if Qt Creator could recommend items e.g. classes from headers that haven't been included. I'm working on a code base (Assimp) that I haven't worked with before, and not having this kind of feature slows me down quite a bit.

    Let's say I'm creating a new class and I want to have a reference to an instance of BaseProcess class. In NetBeans I'd start writing Base and then press Ctrl+Space. NetBeans then recommends BaseImporter and BaseProcess. I select BaseProcess and then NetBeans includes the correct header. When I try to do the same in Qt Creator, it doesn't give any recommendations.

    I'd like to have this feature in Qt Creator too. I tried Qt Creator 4.0 RC, but couldn't find an option to enable such feature. The project is CMake-based. I tried

    Thanks in advance

  • Moderators


    Forgive my bluntness, but this doesn't make much sense. You can't call methods of forward declared/undeclared classes anyway. Creator will parse the headers when included, so autocomplete should work as expected in that case.

    Kind regards.

  • @kshegunov Hello

    I don't think you were blunt, though I think you might have misunderstood the idea.

    I didn't mention anything about autocompleting methods of an instance of a forward declared / undeclared class. I meant that I'd like autocompletion to be able to recommend items e.g. classes from the headers that haven't been included (yet).

  • Moderators


    I think you might have misunderstood the idea

    No, I got the idea. I was just pointing out that for a code to compile, the class you're using should be at least forward declared, and this is how Qt Creator does it. So the IDE can't really know until it sees a class, method, w/e in the headers/sources (i.e. they're at least forward declared) what might exist in other places, simply because it doesn't index things you're not using. It will, however, index the file names (or dirs) that are passed through INCLUDEPATH in the project files, so you can at least get autocompletion for #includes.
    I don't know of any way of forcing QtCreator to index files that are not in the source tree (or parse headers that are not included), but I'm certainly not a last authority on the subject.

    If you believe this is a good thing to have you could file a feature request on the bugtracker, or perhaps raise the point on the interest mailing list where developers of Qt modules could actually see it (this forum is mostly a user community).

    Kind regards.

    You can log in the bugtracker with your forum credentials.

  • @kshegunov Hello,

    thanks for your answer again.

    Note that in my example, BaseProcess is used in many other places, just not yet in the file I was working on. Thus, it sees it already. Also, the files are configured in CMake and can be seen in Project-view.

    Thank you for the link. I will do a feature request on the bugtracker at some point.

    Best regards,

Log in to reply