QtCreator can't Self-recognition new ui item



  • In QtCreator, I drag one QLabel into ui in design mode, then checkout to code edit mode,But I can't use the new QLabel pointer like this in ui class(In old version QtCreator can Self-recognition),

    ui->macLab->setText(id);
    

    I must rebuid project to generate new ui_xxxx.h,then the UI item can be used normal.

    My Qt version:

    0_1553075139020_bddda0e3-a000-41d7-99af-1ffd7db6e7be-image.png


  • Qt Champions 2018

    @RobinsonSir

    I guess you have the Clang Code Model enabled (Help > About Plugins > Clang Code Model). You can try to update Creator to 4.8 or even 4.9-beta (a release candidate is just around the corner).

    Regards



  • @aha_1980 Thanks for your reply , but i didn't load clangCodeModel

    0_1553077340599_decaefe9-9b20-4226-bfb7-0bdbc95ce8c8-image.png

    I will try your suggestion to update QtCreator verion .



  • @RobinsonSir
    Hi,
    Try to manually delete the build directory, I often do this when I have compile o run problems that seem to be unjustified.


  • Qt Champions 2018

    @RobinsonSir Just a note: what you posted is NOT necessarily the Qt version you're using, it's the version of Qt which was used to build QtCreator. To see which Qt version you're using go to the Kit you're using and check which Qt is selected there.



  • @jsulm 0_1553491155729_5df22d01-9b6d-4153-8ce4-e1780ee896ae-image.png

    I think it's a QtCreator bug. I can write code like this:
    ui->macLab->setText(id);
    and compile app ok without error, just QtCreator can't Self-recognition macLab, it doesn't have keyword color.

    0_1553491514756_6199c84c-7f69-4e7e-9696-a329b4126c27-image.png

    Like this, first row macLab is not self-recognition, it's color is black, it should be red color like second row.

    But after I build or rebuild the project , macLab will have red color.

    0_1553491836701_d88f034a-0209-48ff-9a95-5bf6977588d3-image.png

    Some error info like this:

    0_1553503720151_20f1ae2f-2652-4dd3-8481-bbd5c0794f16-image.png


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.