qt autocomplete prompt not showing pointers of my class

  • The problem is that autocomplete prompt not showing name of my class pointer.

    Fragment of my code

      QFile ingredFile;
        if(loadFileWithDirection(&ingredFile, qApp->applicationDirPath() + MENUINXML + INGREDIENTSFILE ))
            QXmlStreamReader *xmlStream = new QXmlStreamReader(&ingredFile);
            while(!xmlStream->atEnd() && !xmlStream->hasError())
                    QXmlStreamReader::TokenType token = xmlStream->readNext();
                    if(token == QXmlStreamReader::StartDocument) {
                    if(token == QXmlStreamReader::StartElement)
                            if(xmlStream->name() == "id")
                            Ingredient *ingredient = new Ingredient();    
                            // when I'm typing ingre I can see prompt with 
                            // class Ingredient, ingredFile (which is 
                            //  declared  above) but is lack of ingredient 
                            // pointer

    If I change code to:

    Ingredient ingredient;
    // now when I'm typing ingre I can see 
    // ingredient on the list of autocomplete prompt 

    I tried to build project and run it, but it doesn't change anything.
    What is more strange when I type xml it shows xmlStream on the list of prompt and this is the pointer, the difference is that these class is not created by me.

    What is reason of this behavior ?

    Did you had problems like this with qt?

    I'm using qt Creator, version:

    Qt Creator 3.2.2 (opensource)

    Based on Qt 5.3.2 (MSVC 2010, 32 bit)

  • Have you explicitly added

    #include "Ingredient.h"

    in your code? Sometimes it's only a matter of where to find the class definition, even though the compilation works just fine.

Log in to reply