Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved qt autocomplete prompt not showing pointers of my class

    Tools
    qt 5.3.2 qt creator 3.2
    2
    2
    701
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      ketjow last edited by

      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) {
                              continue;
                      }
                      if(token == QXmlStreamReader::StartElement)
                      {
      
                              if(xmlStream->name() == "id")
                              {
                                      continue;
                              }
                             
                              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)

      1 Reply Last reply Reply Quote 0
      • ValentinMichelet
        ValentinMichelet last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post