Qt Forum

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

    Update: Forum Guidelines & Code of Conduct

    Qt Creator Namespace Issue (Fixed)

    Tools
    3
    13
    4742
    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.
    • J
      JohnMS last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • Z
        ZapB last edited by

        I would do it with:

        @
        #include "myheader.h"

        using namespace A;
        ...
        D f;
        @

        That works for me here (qt-creator 2.1.0)

        Nokia Certified Qt Specialist
        Interested in hearing about Qt related work

        1 Reply Last reply Reply Quote 0
        • V
          vinb last edited by

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

          1 Reply Last reply Reply Quote 0
          • J
            JohnMS last edited by

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

            1 Reply Last reply Reply Quote 0
            • V
              vinb last edited by

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

              1 Reply Last reply Reply Quote 0
              • J
                JohnMS last edited by

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

                1 Reply Last reply Reply Quote 0
                • V
                  vinb last edited by

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

                  1 Reply Last reply Reply Quote 0
                  • J
                    JohnMS last edited by

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

                    1 Reply Last reply Reply Quote 0
                    • V
                      vinb last edited by

                      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]

                      1 Reply Last reply Reply Quote 0
                      • J
                        JohnMS last edited by

                        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

                        1 Reply Last reply Reply Quote 0
                        • Z
                          ZapB last edited by

                          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.

                          Nokia Certified Qt Specialist
                          Interested in hearing about Qt related work

                          1 Reply Last reply Reply Quote 0
                          • V
                            vinb last edited by

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

                            1 Reply Last reply Reply Quote 0
                            • J
                              JohnMS last edited by

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

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