Qt Creator Namespace Issue (Fixed)



  • Is there a known issue with Qt Creator 2.0.1 that it does not autocompete objects within a namespae for example:

    @
    namespace A
    {
    class B
    {
    public:
    int c;
    };
    class D
    {
    public:
    B e;
    };
    }
    @

    Inside another file:
    @
    using A::D;
    D f;
    @
    When you type f and then dot the autocomplete will not appear. Without the namespace, the autocomplete works perfectly.



  • I would do it with:

    @
    #include "myheader.h"

    using namespace A;
    ...
    D f;
    @

    That works for me here (qt-creator 2.1.0)



  • @JohnMS:
    works also ok with me!
    mayby you can upgrade your Qt creator?



  • [quote author="ZapB" date="1301336415"]I would do it with: @ #include "myheader.h" using namespace A; ... D f; @ That works for me here (qt-creator 2.1.0)[/quote]

    That worked for me as well, but it has the disadvantage of bring in the entire namespace, something I would rather avoid if possible.



  • then i think you can just use
    A::D f;
    and not 'using'



  • [quote author="vinb" date="1301337969"]then i think you can just use A::D f; and not 'using'[/quote]

    That of course works. :D But it does address is it a bug in Qt Creator that need to be submitted. :P Bringing in an entire namespace is not everyone's prefered method of writting code.



  • I didnt know that your bringing in the whole namespace A when using:
    A::D



  • [quote author="vinb" date="1301338717"]I didnt know that your bringing in the whole namespace A when using: A::D [/quote]
    Sorry about that I should have been more specific when I said that
    @using A::D@ does not breing in the whole namespace.
    @using namespace A;@ does bring in the whole namespace.



  • thats what i ment. :)
    but then i dont understand your folowing post:

    [quote author="JohnMS" date="1301338178"]
    That of course works. :D But it does address is it a bug in Qt Creator that need to be submitted. :P Bringing in an entire namespace is not everyone's prefered method of writting code.
    [/quote]



  • Wow, I'm loosing my mind. LOL @A::D f@ Should have been @using A::D@ The advantage being that I only bring in the one class that I'm using from that namespace, instead of every class from that namespace. And I can declare a variable @D f@ without needing to specify the namespace.
    Note: went back and corrected for future generations. :D



  • Try the latest beta of qt-creator 2.2. I understand that this has seen several improvements to the code model that is used by the auto-completer. If it is still broken there then please report it as a bug.



  • @JohnMS:
    Ah ok, i understand it now. :)



  • [quote author="ZapB" date="1301340439"]Try the latest beta of qt-creator 2.2. I understand that this has seen several improvements to the code model that is used by the auto-completer. If it is still broken there then please report it as a bug.[/quote]

    Verified that it works in 2.1, as I'm at work, I can't verify the beta build.


Log in to reply
 

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