Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
rincewind last edited by
I'm not sure what is at fault here, but I just noticed that there are some inconsistencies with the QApplication constructors.
If I type the following code in the editor:
QCoreApplication *application = new QApplication(
the code completion shows me that there are 4 different constructors, but if I press F1 on QApplication, none of the constructors in the help match the signatures of the constructors listed by the code completion.
According to the help:
QApplication ( int & argc, char ** argv )
QApplication ( int & argc, char ** argv, bool GUIenabled )
QApplication ( int & argc, char ** argv, Type type )
QApplication ( Display * display, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0 )
QApplication ( Display * display, int & argc, char ** argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0 )
QApplication ( QApplication::QS60MainApplicationFactory factory, int & argc, char ** argv )
If I introduce a compile error, the output is:
..\Launcher\main.cpp:15: error: no matching function for call to 'QApplication::QApplication(int, int)'
....\QtSDK\Desktop\Qt\4.8.0\mingw\include\QtGui/qapplication.h:389: note: candidates are: QApplication::QApplication(const QApplication&)
....\QtSDK\Desktop\Qt\4.8.0\mingw\include\QtGui/qapplication.h:130: note: QApplication::QApplication(int&, char**, QApplication::Type, int)
....\QtSDK\Desktop\Qt\4.8.0\mingw\include\QtGui/qapplication.h:129: note: QApplication::QApplication(int&, char**, bool, int)
....\QtSDK\Desktop\Qt\4.8.0\mingw\include\QtGui/qapplication.h:128: note: QApplication::QApplication(int&, char**, int)
It looks like the code completion at least matches the compiler. The online Qt documentation matches the help in QtCreator. So, is this simply a case of incorrect documentation?
miroslav last edited by
Note that the first parameter is a reference to int, not an int.
rincewind last edited by
Yep, noticed that. Which is also interesting since the code
QCoreApplication *application = new QApplication(0, 0);
Compiles on Ubuntu with the Qt Creator installed from the repository and I think Qt 4.7.1. But it shouldn't...
But that's not the point, the point is the difference between the help file and the actual code.
lgeyer last edited by
I haven't verified this but the last parameter might be marked as internal (it is even named internal if I recall correctly), which means that it is hidden in the documentation (automatically by the documentation tool) but shown in Qt Creator - which just analyzes the source files and suggests what found.
Be aware that some of the constructors are available on certain platforms only.