With master every time I invoke autocompletion for a (not yet included) QFoo class, it offer to include "qfoo.h", but doesn't offer <QFoo> . This used to work some time ago.
can you provide a small project that triggers this behavior? it works fine for me :-/
I can reproduce by creating a new project from inside KDevelop: KDE->Graphical->Cmake-Qt-C++ project, remove the #include statements for QLabel, etc. and then try to add them back using the autocompletion. Some extra information from my system: - i have a self compiled Qt (and the system Qt as well, of course) - system Qt is in /usr - self compiled is in /data/development/sources/qt - Qt is compiled in-source (so no need to install it) - I have a symlink from /opt/qt4 to /data/development/sources/qt - QTDIR=/opt/qt4 - compiling the test project gives this output: /usr/bin/c++ -g -I/data/development/sources/qt/include/QtDesigner -I/data/development/sources/qt/include/QtDeclarative -I/data/development/sources/qt/include/QtScriptTools -I/data/development/sources/qt/include/QtDBus -I/data/development/sources/qt/include/QtXml -I/data/development/sources/qt/include/QtSql -I/data/development/sources/qt/include/QtOpenGL -I/data/development/sources/qt/include/QtMultimedia -I/data/development/sources/qt/include/QtNetwork -I/data/development/sources/qt/include/phonon -I/data/development/sources/qt/include/QtXmlPatterns -I/data/development/sources/qt/include/QtWebKit -I/data/development/sources/qt/include/QtHelp -I/data/development/sources/qt/include/QtUiTools -I/data/development/sources/qt/include/QtTest -I/data/development/sources/qt/include/QtScript -I/data/development/sources/qt/include/QtSvg -I/data/development/sources/qt/include/Qt3Support -I/data/development/sources/qt/include/QtGui -I/data/development/sources/qt/include/QtCore -I/data/development/sources/qt/mkspecs/default -I/data/development/sources/qt/include -I/encrypted/home/andris/projects/a/build -o CMakeFiles/a.dir/a.cpp.o -c /encrypted/home/andris/projects/a/a.cpp (so paths are fine) /usr/bin/c++ -g -I/data/development/sources/qt/include/QtDesigner -I/data/development/sources/qt/include/QtDeclarative -I/data/development/sources/qt/include/QtScriptTools -I/data/development/sources/qt/include/QtDBus -I/data/development/sources/qt/include/QtXml -I/data/development/sources/qt/include/QtSql -I/data/development/sources/qt/include/QtOpenGL -I/data/development/sources/qt/include/QtMultimedia -I/data/development/sources/qt/include/QtNetwork -I/data/development/sources/qt/include/phonon -I/data/development/sources/qt/include/QtXmlPatterns -I/data/development/sources/qt/include/QtWebKit -I/data/development/sources/qt/include/QtHelp -I/data/development/sources/qt/include/QtUiTools -I/data/development/sources/qt/include/QtTest -I/data/development/sources/qt/include/QtScript -I/data/development/sources/qt/include/QtSvg -I/data/development/sources/qt/include/Qt3Support -I/data/development/sources/qt/include/QtGui -I/data/development/sources/qt/include/QtCore -I/data/development/sources/qt/mkspecs/default -I/data/development/sources/qt/include -I/encrypted/home/andris/projects/a/build -o CMakeFiles/a.dir/a.cpp.o -c /encrypted/home/andris/projects/a/a.cpp Generated CMakeLists.txt: roject(a) cmake_minimum_required(VERSION 2.6) find_package(Qt4 REQUIRED) include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}) set(a_SRCS a.cpp main.cpp) qt4_automoc(${a_SRCS}) add_executable(a ${a_SRCS}) target_link_libraries(a ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
qmake -query QT_INSTALL_PREFIX:/data/development/sources/qt QT_INSTALL_DATA:/data/development/sources/qt QT_INSTALL_DOCS:/data/development/sources/qt/doc QT_INSTALL_HEADERS:/data/development/sources/qt/include QT_INSTALL_LIBS:/data/development/sources/qt/lib QT_INSTALL_BINS:/data/development/sources/qt/bin QT_INSTALL_PLUGINS:/data/development/sources/qt/plugins QT_INSTALL_IMPORTS:/data/development/sources/qt/imports QT_INSTALL_TRANSLATIONS:/data/development/sources/qt/translations QT_INSTALL_CONFIGURATION:/etc/xdg QT_INSTALL_EXAMPLES:/data/development/sources/qt/examples QT_INSTALL_DEMOS:/data/development/sources/qt/demos QMAKE_MKSPECS:/data/development/sources/qt/mkspecs QMAKE_VERSION:2.01a QT_VERSION:4.8.0
Still broken for you?
Yes, it is.
(Set back the status to New)
I also get this (sometimes?) when working with Qt5. Can someone check what's going on here? Also very annoying.
I need a project to reproduce this. It works with the steps outlined by Andras above. Maybe b/c I don't compile Qt4 on my own? Kevin, if you can find a minimal project with Qt5, please attach it and tell me what you did to use Qt5 there.
Apparently that's really problem of using self-compiled Qt and using one from /usr/include. The subtle difference: In self-compiled Qt: The header QState includes "qstate.h" which again includes something like "../../../../src/qt/src/corelib/statemachine/qstate.h". Hence, the QState file is not considered an direct importer of "../../../../src/qt/src/corelib/statemachine/qstate.h" and is discarded. In Cpp::missingIncludeCompletionItems: decl->topContext()->parsingEnvironmentFile()->importers() only returns files such as '/path/to/qstate.h'. Apparently DUContextDynamicData::addImportedChildContext is responsible for "sorting" out indirect imports. Does that make sense? Even if it does, I don't know how to fix. This is quite internal stuff.
commit 38230648e0bb88bc437017ef70bb59dec31ca528 Author: Kevin Funk <kevin@kfunk.org> Date: Fri Jan 31 14:13:03 2014 +0100 Introduce new technique to lookup forward headers We are now able to propose headers in the missing-include assistant, which were not parsed before (i.e. that are not in the DUChain). The procedure is simple: Assume we write something like 'QState', and qstate.h is not yet included nor parsed, in some file foo.cpp. KDevelop then checks if there is a file called 'QState' in any of the include paths required to build foo.cpp and then adds it to the list of possible include directives. This is possibly useful in other areas, e.g. for the "Create From Template" feature, as well.
Git commit 30181d739a334f7a3a2b2f87afbb520db13114fd by Kevin Funk. Committed on 31/01/2014 at 13:13. Pushed by kfunk into branch 'master'. Introduce new technique to lookup forward headers We are now able to propose headers in the missing-include assistant, which were not parsed before (i.e. that are not in the DUChain). The procedure is simple: Assume we write something like 'QState', and qstate.h is not yet included nor parsed, in some file foo.cpp. KDevelop then checks if there is a file called 'QState' in any of the include paths required to build foo.cpp and then adds it to the list of possible include directives. This is possibly useful in other areas, e.g. for the "Create From Template" feature, as well. M +41 -24 languages/cpp/codecompletion/missingincludeitem.cpp http://commits.kde.org/kdevelop/30181d739a334f7a3a2b2f87afbb520db13114fd