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.1k 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.
  • P Offline
    P Offline
    Perdrix
    wrote on 3 May 2023, 00:27 last edited by
    #1

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

    What does checking this do?

    C 1 Reply Last reply 3 May 2023, 04:46
    0
    • P Perdrix
      3 May 2023, 00:27

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

      What does checking this do?

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 3 May 2023, 04:46 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

      P 1 Reply Last reply 3 May 2023, 07:47
      0
      • C Christian Ehrlicher
        3 May 2023, 04:46

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

        P Offline
        P Offline
        Perdrix
        wrote on 3 May 2023, 07:47 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.

        J C 2 Replies Last reply 3 May 2023, 08:05
        0
        • P Perdrix
          3 May 2023, 07:47

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

          D.

          J Offline
          J Offline
          JonB
          wrote on 3 May 2023, 08:05 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
          • P Perdrix
            3 May 2023, 07:47

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

            D.

            C Offline
            C Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on 3 May 2023, 08:59 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.

            P 1 Reply Last reply 3 May 2023, 10:12
            0
            • C Chris Kawa
              3 May 2023, 08:59

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

              P Offline
              P Offline
              Perdrix
              wrote on 3 May 2023, 10:12 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.

              C 1 Reply Last reply 3 May 2023, 10:23
              0
              • P Perdrix
                3 May 2023, 10:12

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

                C Offline
                C Offline
                Chris Kawa
                Lifetime Qt Champion
                wrote on 3 May 2023, 10:23 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.

                P 1 Reply Last reply 3 May 2023, 10:50
                1
                • C Chris Kawa
                  3 May 2023, 10:23

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

                  P Offline
                  P Offline
                  Perdrix
                  wrote on 3 May 2023, 10:50 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.

                  C 1 Reply Last reply 3 May 2023, 11:51
                  0
                  • P Perdrix
                    3 May 2023, 10:50

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

                    C Offline
                    C Offline
                    Chris Kawa
                    Lifetime Qt Champion
                    wrote on 3 May 2023, 11:51 last edited by Chris Kawa 5 Mar 2023, 19:50
                    #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 4 May 2023, 07:21 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

                      10/10

                      4 May 2023, 07:21

                      • Login

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