What does the "Global include" check box do
-
The Designer "Promoted Widgets" dlg has a tick box "Global include".
What does checking this do?
@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>
. -
@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>
.@Christian-Ehrlicher ??? What includes foo.h ??? I don't so how come that gets added as an include for every file?
D.
-
@Christian-Ehrlicher ??? What includes foo.h ??? I don't so how come that gets added as an include for every file?
D.
-
@Christian-Ehrlicher ??? What includes foo.h ??? I don't so how come that gets added as an include for every file?
D.
@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 aui_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 fromfoobar = new QWidget()
tofoobar = new MyWidget()
. For that to work there needs to be include for your custom widget in thatui_something.h
header, either#include "mywidget.h"
or#include <mywidget.h>
and that setting controls which form to use. -
@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 aui_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 fromfoobar = new QWidget()
tofoobar = new MyWidget()
. For that to work there needs to be include for your custom widget in thatui_something.h
header, either#include "mywidget.h"
or#include <mywidget.h>
and that setting controls which form to use.@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-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.
@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. -
@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.@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-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.
@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.
-
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.