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. What does the "Global include" check box do

What does the "Global include" check box do

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
10 Posts 5 Posters 1.8k Views 3 Watching
  • 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by
    #1

    The Designer "Promoted Widgets" dlg has a tick box "Global include".

    What does checking this do?

    Christian EhrlicherC 1 Reply Last reply
    0
    • PerdrixP Perdrix

      The Designer "Promoted Widgets" dlg has a tick box "Global include".

      What does checking this do?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Perdrix said in What does the "Global include" check box do:

      What does checking this do?

      It adds the include as global include by using <foo.h>.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      PerdrixP 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        @Perdrix said in What does the "Global include" check box do:

        What does checking this do?

        It adds the include as global include by using <foo.h>.

        PerdrixP Offline
        PerdrixP Offline
        Perdrix
        wrote on last edited by
        #3

        @Christian-Ehrlicher ??? What includes foo.h ??? I don't so how come that gets added as an include for every file?

        D.

        JonBJ Chris KawaC 2 Replies Last reply
        0
        • PerdrixP Perdrix

          @Christian-Ehrlicher ??? What includes foo.h ??? I don't so how come that gets added as an include for every file?

          D.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @Perdrix said in What does the "Global include" check box do:

          What includes foo.h ???

          At a guess, did you look inside the generated ui_....h file from your .ui file which uses the promoted widget?

          1 Reply Last reply
          0
          • PerdrixP Perdrix

            @Christian-Ehrlicher ??? What includes foo.h ??? I don't so how come that gets added as an include for every file?

            D.

            Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Perdrix said:

            ??? What includes foo.h ??? I don't so how come that gets added as an include for every file?

            It's not in every file. When you have a something.ui file uic generates a ui_something.h file that has the C++ code. Promoting is a simple substitution, so for example when you promote QWidget to MyWidget the generated code changes from foobar = new QWidget() to foobar = new MyWidget(). For that to work there needs to be include for your custom widget in that ui_something.h header, either #include "mywidget.h" or #include <mywidget.h> and that setting controls which form to use.

            PerdrixP 1 Reply Last reply
            0
            • Chris KawaC Chris Kawa

              @Perdrix said:

              ??? What includes foo.h ??? I don't so how come that gets added as an include for every file?

              It's not in every file. When you have a something.ui file uic generates a ui_something.h file that has the C++ code. Promoting is a simple substitution, so for example when you promote QWidget to MyWidget the generated code changes from foobar = new QWidget() to foobar = new MyWidget(). For that to work there needs to be include for your custom widget in that ui_something.h header, either #include "mywidget.h" or #include <mywidget.h> and that setting controls which form to use.

              PerdrixP Offline
              PerdrixP Offline
              Perdrix
              wrote on last edited by
              #6

              @Chris-Kawa So you're saying that ticking "Global include" changes the #include used for e.g. imageviewer.h from

              #include "imageviewer.h"

              to

              #include <imageviewer.h>

              OK that makes sense, but it most definitely isn't clear what that tick box means and AFAICT there nothing about it in the help for Designer.

              Chris KawaC 1 Reply Last reply
              0
              • PerdrixP Perdrix

                @Chris-Kawa So you're saying that ticking "Global include" changes the #include used for e.g. imageviewer.h from

                #include "imageviewer.h"

                to

                #include <imageviewer.h>

                OK that makes sense, but it most definitely isn't clear what that tick box means and AFAICT there nothing about it in the help for Designer.

                Chris KawaC Offline
                Chris KawaC Offline
                Chris Kawa
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @Perdrix <foo.h> are global includes and "foo.h" are relative. That's how it is in C++. Designer documentation is not a C++ handbook.

                PerdrixP 1 Reply Last reply
                1
                • Chris KawaC Chris Kawa

                  @Perdrix <foo.h> are global includes and "foo.h" are relative. That's how it is in C++. Designer documentation is not a C++ handbook.

                  PerdrixP Offline
                  PerdrixP Offline
                  Perdrix
                  wrote on last edited by
                  #8

                  @Chris-Kawa I'm totally aware of the difference between "" and <> - I've been doing C/C++ for years.

                  What isn't made clear in the Designer docs is what that tick box is referring to. It's not clear from the GUI that this is what is being referred to.

                  Chris KawaC 1 Reply Last reply
                  0
                  • PerdrixP Perdrix

                    @Chris-Kawa I'm totally aware of the difference between "" and <> - I've been doing C/C++ for years.

                    What isn't made clear in the Designer docs is what that tick box is referring to. It's not clear from the GUI that this is what is being referred to.

                    Chris KawaC Offline
                    Chris KawaC Offline
                    Chris Kawa
                    Lifetime Qt Champion
                    wrote on last edited by Chris Kawa
                    #9

                    @Perdrix The tooltip says "Indicates that the header file is a global header file". Sounds good to me, but if you have an idea how to improve that description you can make a suggestion in the bugtracker. I'm sure this is something that can be easily changed.

                    1 Reply Last reply
                    1
                    • S Offline
                      S Offline
                      SimonSchroeder
                      wrote on last edited by
                      #10

                      The C++ standard is more vague about the meaning of <> vs "". It just states that "" might search additional directories before falling back to the same directories as <>. It is implementation dependent what the differences between <> and "" are. Sure, there is a convention to use <> for the STL and maybe 3rd party libraries and "" for your own. But, I have never heard of the description "global header". Nevertheless, I don't know of any better single word to describe this. The only obvious difference between the two (according to the standard) is the different characters/tokens used.

                      1 Reply Last reply
                      1

                      • Login

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