0

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?

Lukas W
  • 305
  • 1
  • 9
  • 2
    Technically (and nitpicking), the IDE is not Qt, but [QtCreator](http://www.qt.io/ide/). And your problem have nothing to do with the compiler, but the IDE that apparently can't handle such data-types. – Some programmer dude Jun 17 '15 at 07:03

1 Answers1

0

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

Lukas W
  • 305
  • 1
  • 9
  • I did everything you said and restarted the IDE, but it didn't solve. – Pedro Souza Jun 17 '15 at 07:59
  • Maybe the file you're editing is a header? Try switching everything to Clang, not just `C++` like in the screenshot. – Lukas W Jun 17 '15 at 08:03
  • No, it's not a header. I'm editing the main. I changed everything to Clang and didn't solve again. Do you have other idea? – Pedro Souza Jun 17 '15 at 08:10
  • I don't, sorry. You could check if the plugin is loaded correctly by looking for the green check mark next to it in the `About Plugins` dialog. But on the other hand, you probably wouldn't be able to select it in the options if it failed loading. – Lukas W Jun 17 '15 at 08:17
  • 1
    Anyway, I'm grateful by your answer. – Pedro Souza Jun 17 '15 at 08:20