I am looking at qt-x11-opensource-src-4.3.0-snapshot-20070315\src\gui\kernel\qapplication.h and I find that at line 235 the exec() function has been declared static. So are many other functions like font(), palette() and even setFont(), setPalette() etc.
My understanding about static functions in C++ is that their only need is when a member function of a class can/needs to be called without an instance of that class, like for example the currentDateTime() function which is a member of the QDateTime class but can be called without an instance of that class. In fact, this function has no particular meaning when called upon an instance of that class since it does not create, access, modify or delete that instance in any way. So I can understand why currentDateTime() is a static member of QDateTime.
But I do not understand how exec(), font(), palette(), setFont(), setPalette() etc can be static when to my understanding these can be called only upon an instance of the QApplication class. Although for a Qt application there is only once instance of a QApplication class, the exec() and other functions are by definition dependent on this particular instance and have no meaning when separated from this instance. For example, setFont() can set the default application font only for the current application running and that means only an existing instance of QApplication. If there is no existing instance of QApplication, whose default font will setFont() modify?
Therefore I feel that it is meaningless to declare these functions as static. Please anyone confirm or disprove this hypothesis of mine. If my hypothesis is confirmed I can file a bug. Thank you.
Bookmarks