<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>287492</bug_id>
          
          <creation_ts>2011-11-24 20:51:48 +0000</creation_ts>
          <short_desc>Qt includes are not offered in #include &lt;QFoo&gt; form</short_desc>
          <delta_ts>2014-01-31 13:36:11 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>kdevelop</product>
          <component>Language Support: CPP (old)</component>
          <version>git master</version>
          <rep_platform>Compiled Sources</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>regression</keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.6.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="András Manţia">amantia</reporter>
          <assigned_to>kdevelop-bugs-null</assigned_to>
          <cc>kfunk</cc>
          
          <cf_commitlink>http://commits.kde.org/kdevelop/30181d739a334f7a3a2b2f87afbb520db13114fd</cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1190179</commentid>
    <comment_count>0</comment_count>
    <who name="András Manţia">amantia</who>
    <bug_when>2011-11-24 20:51:48 +0000</bug_when>
    <thetext>With master every time I invoke autocompletion for a (not yet included) QFoo class, it offer to include &quot;qfoo.h&quot;, but doesn&apos;t offer &lt;QFoo&gt; . This used to work some time ago.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1190660</commentid>
    <comment_count>1</comment_count>
    <who name="Milian Wolff">mail</who>
    <bug_when>2011-11-26 00:19:28 +0000</bug_when>
    <thetext>can you provide a small project that triggers this behavior? it works fine for me :-/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1190913</commentid>
    <comment_count>2</comment_count>
    <who name="András Manţia">amantia</who>
    <bug_when>2011-11-26 21:20:02 +0000</bug_when>
    <thetext>I can reproduce by creating a new project from inside KDevelop:
KDE-&gt;Graphical-&gt;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})</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1190916</commentid>
    <comment_count>3</comment_count>
    <who name="András Manţia">amantia</who>
    <bug_when>2011-11-26 21:21:29 +0000</bug_when>
    <thetext>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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1320549</commentid>
    <comment_count>4</comment_count>
    <who name="Kevin Funk">kfunk</who>
    <bug_when>2012-12-02 23:08:37 +0000</bug_when>
    <thetext>Still broken for you?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1320648</commentid>
    <comment_count>5</comment_count>
    <who name="András Manţia">amantia</who>
    <bug_when>2012-12-03 10:29:38 +0000</bug_when>
    <thetext>Yes, it is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1320649</commentid>
    <comment_count>6</comment_count>
    <who name="András Manţia">amantia</who>
    <bug_when>2012-12-03 10:30:10 +0000</bug_when>
    <thetext>(Set back the status to New)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1427686</commentid>
    <comment_count>7</comment_count>
    <who name="Kevin Funk">kfunk</who>
    <bug_when>2014-01-29 16:14:26 +0000</bug_when>
    <thetext>I also get this (sometimes?) when working with Qt5. Can someone check what&apos;s going on here? Also very annoying.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1427692</commentid>
    <comment_count>8</comment_count>
    <who name="Milian Wolff">mail</who>
    <bug_when>2014-01-29 16:47:05 +0000</bug_when>
    <thetext>I need a project to reproduce this. It works with the steps outlined by Andras above. Maybe b/c I don&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1427713</commentid>
    <comment_count>9</comment_count>
    <who name="Kevin Funk">kfunk</who>
    <bug_when>2014-01-29 19:33:21 +0000</bug_when>
    <thetext>Apparently that&apos;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 &quot;qstate.h&quot; which again includes something like &quot;../../../../src/qt/src/corelib/statemachine/qstate.h&quot;. Hence, the QState file is not considered an direct importer of  &quot;../../../../src/qt/src/corelib/statemachine/qstate.h&quot; and is discarded.

In Cpp::missingIncludeCompletionItems: decl-&gt;topContext()-&gt;parsingEnvironmentFile()-&gt;importers() only returns files such as &apos;/path/to/qstate.h&apos;.

Apparently DUContextDynamicData::addImportedChildContext is responsible for &quot;sorting&quot; out indirect imports. Does that make sense? Even if it does, I don&apos;t know how to fix. This is quite internal stuff.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1428047</commentid>
    <comment_count>10</comment_count>
    <who name="Kevin Funk">kfunk</who>
    <bug_when>2014-01-31 13:24:41 +0000</bug_when>
    <thetext>commit 38230648e0bb88bc437017ef70bb59dec31ca528
Author: Kevin Funk &lt;kevin@kfunk.org&gt;
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 &apos;QState&apos;,
    and qstate.h is not yet included nor parsed, in some file foo.cpp.
    KDevelop then checks if there is a file called &apos;QState&apos; 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 &quot;Create From
    Template&quot; feature, as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1428048</commentid>
    <comment_count>11</comment_count>
    <who name="Kevin Funk">kfunk</who>
    <bug_when>2014-01-31 13:36:11 +0000</bug_when>
    <thetext>Git commit 30181d739a334f7a3a2b2f87afbb520db13114fd by Kevin Funk.
Committed on 31/01/2014 at 13:13.
Pushed by kfunk into branch &apos;master&apos;.

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 &apos;QState&apos;,
and qstate.h is not yet included nor parsed, in some file foo.cpp.
KDevelop then checks if there is a file called &apos;QState&apos; 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 &quot;Create From
Template&quot; feature, as well.

M  +41   -24   languages/cpp/codecompletion/missingincludeitem.cpp

http://commits.kde.org/kdevelop/30181d739a334f7a3a2b2f87afbb520db13114fd</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>