Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator Namespace Issue (Fixed)
QtWS25 Last Chance

Qt Creator Namespace Issue (Fixed)

Scheduled Pinned Locked Moved Qt Creator and other tools
13 Posts 3 Posters 5.5k Views
  • 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 Offline
    J Offline
    JohnMS
    wrote on last edited by
    #1

    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
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on last edited by
      #2

      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
      0
      • V Offline
        V Offline
        vinb
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JohnMS
          wrote on last edited by
          #4

          [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
          0
          • V Offline
            V Offline
            vinb
            wrote on last edited by
            #5

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

            1 Reply Last reply
            0
            • J Offline
              J Offline
              JohnMS
              wrote on last edited by
              #6

              [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
              0
              • V Offline
                V Offline
                vinb
                wrote on last edited by
                #7

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

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  JohnMS
                  wrote on last edited by
                  #8

                  [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
                  0
                  • V Offline
                    V Offline
                    vinb
                    wrote on last edited by
                    #9

                    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
                    0
                    • J Offline
                      J Offline
                      JohnMS
                      wrote on last edited by
                      #10

                      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
                      0
                      • Z Offline
                        Z Offline
                        ZapB
                        wrote on last edited by
                        #11

                        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
                        0
                        • V Offline
                          V Offline
                          vinb
                          wrote on last edited by
                          #12

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

                          1 Reply Last reply
                          0
                          • J Offline
                            J Offline
                            JohnMS
                            wrote on last edited by
                            #13

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

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved