PDA

View Full Version : #include <QBean>... what's it mean?



magland
9th July 2007, 01:16
I often see "#include <QString>" or "#include <QMainWindow>" or whatever. In fact I use this syntax too. My question is... what does it translate to by the precompiler? For example, does the precompiler simply turn the "QMainWindow" to all lowercase and then add a .h? Or is there something else going on behind the scenes? For example, would #include <qStrinG> be incorrect? What's the general rule?

jpn
9th July 2007, 06:55
I often see "#include <QString>" or "#include <QMainWindow>" or whatever. In fact I use this syntax too. My question is... what does it translate to by the precompiler? For example, does the precompiler simply turn the "QMainWindow" to all lowercase and then add a .h? Or is there something else going on behind the scenes?
These are so called "convenience headers". The headers actually exist but all they do is to include the corresponding actual header. For example header QMainWindow includes qmainwindow.h. This is also what module headers do; for example header QtGui includes actual headers of classes belonging to QtGui module.


For example, would #include <qStrinG> be incorrect? What's the general rule?
Yes, it's incorrect. Still if this works on file systems that do no care about the case (like Windows) it breaks on file systems that do care (like Linux). No black magic is done behind the curtains. ;)