Search code examples
c++dictionaryhashqt-creatorcode-completion

IDE doesn't recognize the method


I'm trying to acces the cityMethod() inside the class City.

class City
{
    void cityMethod() { }
}

So, I do:

map<string,City> mymap;
City c;
mymap["Madrid"] = c;

Now, when I do this:

mymap["Madrid"].cityMethod();

Ok, it works. But the IDE(Qt) doesn't recognize the "cityMethod". Am I doing something wrong? Is that compiler issue?


Solution

  • This feature does not seem to be supported by Qt Creator. There's an open issue about it on http://bugreports.qt.io/.

    It does work when using the ClangCodeModel plugin though. To use it, go to Help > About Plugins and activate the plugin there:

    enter image description here

    Then, enable its use in the options. Tools > Options > C++ > Code Model

    enter image description here

    You might experience performance issues with the Clang code model, but it does work:

    enter image description here