Qt Creator - Code completion in implementation file



  • Hi,

    It appears that code completion does not work in implementation files unless I specify the fully qualified name of the class for the method in question.

    For example, the following will disable all code completion for the current class:

    @using a::b::MyClass;
    void MyClass::myMethod()
    {
    // code completion will not work for any instance variables or other methods in class
    }@

    If I remove the using and re-declare the method as

    @void a::b::MyClass::myMethod()
    {
    // code completion works as expected
    }@

    Any reason why the first way is disabled in Qt Creator? I am a C++ newbie, so am not sure if the first method is considered bad style.

    Thanks
    Rakesh



  • Which version of QtCreator are you using? I have not noticed this, and I define nearly all of my classes in a namespace and use "using" rather than full qualification of each method.



  • 2.4.0 on Mac OS X Snow Leopard with Vim emulation enabled.



  • You should change your first line to

    @
    using namespace a::b;
    @



  • Thanks, that does the trick. Out of curiosity, is there a reason for the first way to be not supported?



  • "using namespace a::b" imports all symbols of a certain namespace.

    "using a::b::MyClass" only imports the name MyClass only.

    Using gcc, this results in no difference during compilation as it seems, I don't know if that's some relaxed behavior or if it's standards compliant. A true C++ guru should jump in here for some clarification...


Log in to reply
 

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