Donotalo Donotalo - 1 year ago 167
C++ Question

Qt Creator cannot resolve STL containers

I've downloaded Qt 5.4 for Windows, running it in Windows 8.1 Pro. It comes with MingW and Qt Creator 3.3.

I've been using Qt for few years. Still a very necessary component seems missing in the Qt Creator IDE. Suppose a class

is defined with a function

class Card
string getSymbol() const;

Somewhere in code I've a

vector<Card> playable;

And somewhere else in code:

^----------------- Note this dot

When I type the period in the line above, Qt Creator should list available functions and variables of
class to be used, just like IntelliSense works in VS. But that doesn't happen. However, when I create an object of type
, then the dot triggers Qt Creator to show available functions:

enter image description here

Why this feature doesn't work when
objects are put in STL containers? Is there any settings that needs to be enabled?

Answer Source

This has been a long standing issue discussed asked and asked over again on forums and mailing lists. As thuga correctly showed in the comment, this is the corresponding bugreport to monitor:

Code completion does not work for std::vector of objects

Note that QtCreator was primarily meant for working with Qt code and so you would use QVector in such projects which is working. I am not saying that it is not worth fixing, but that is at least the history.

This may be getting closer and closer with using clang inside QtCreator, but I guess you will need to wait.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download