I was looking at one of the c++ based frameworks. There is a class QMainWindow which uses the below syntax
.....
class QMenu;
class Q_GUI_EXPORT QMainWindow : public QWidget
{
Q_OBJECT
Q_ENUMS(DockOption)
Q_FLAGS(DockOptions)
......
I am struggling to get grips on the syntax here (have got limited exposure to the c++ world)
class QMenu is defined in an another header file, what does the line class QMenu; do in the above code which is in QMainWindow class ?
Also what does Q_GUI_EXPORT do? does it export this class?
What does Q_OBJECT line do ?
class QMenu; is a forward declaration. It says to the compiler that there is a class named QMenu. It makes it possible to have pointers and references to QMenu objects without having to include the header that defines QMenu. To be able to create instances of QMenu, or call any of its member functions you will need the full class definition.
Q_GUI_EXPORT and Q_OBJECT are probably macros. I don't know what they are used for.
is the part of the mechanism that Qt uses through the Meta Object Compiler, to achieve the ability to have slots & connections, RTTI etc. I think you need to do a lot more reading, to get an understanding of Qt.
GUI's are not trivial things - there can as much learning (if not more) in a GUI, than there is in learning a language like C++. It would be a huge advantage in knowing a reasonable amount about C++ before trying to tackle Qt.
I am not trying to discourage you, I managed to pick up the rudiments of Qt reasonably quickly while I had a limited knowledge of C++. But it took a lot of reading & figuring out. Knowledge is a relative thing, but obviously the more you have, the better off you will be. I guess learning new things has always been a part of the challenge in Computer Science.