Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Creator - Code completion in implementation file

    Tools
    3
    6
    2634
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sptrakesh last edited by

      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

      1 Reply Last reply Reply Quote 0
      • C
        Chris H last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • S
          sptrakesh last edited by

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

          1 Reply Last reply Reply Quote 0
          • G
            goetz last edited by

            You should change your first line to

            @
            using namespace a::b;
            @

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply Reply Quote 0
            • S
              sptrakesh last edited by

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

              1 Reply Last reply Reply Quote 0
              • G
                goetz last edited by

                "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...

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post