Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [VS2019] Intellisense doesn't recognize objectName change unless restart
Forum Updated to NodeBB v4.3 + New Features

[VS2019] Intellisense doesn't recognize objectName change unless restart

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
5 Posts 2 Posters 438 Views 1 Watching
  • 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.
  • Q Offline
    Q Offline
    Q74r3wq-
    wrote on last edited by
    #1

    Hi experts,

    I changed the objectName of a label from label to nameLabel, saved the .ui file but the change was not reflected in the .cpp file. Intellisense still shows label but the program won't build unless I changed it to nameLabel.

    I think this is an issue pretty similar to:
    https://forum.qt.io/topic/91053/changing-objectname-in-design-view-does-not-update-names-in-mainwindow-cpp

    Here are what I tried:

    • Re-build, didn't work
    • Re-open .ui file and save, didn't work
    • Check the ui_blah.h file and the name is indeed nameLabel, didn't work
    • Restart editor, finally worked!

    Question is: is there a way to solve this without restarting? I guess it's not a deal breaker but could be annoying from time to time.

    Thanks!

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      It's not a Qt specific thing. It's a general problem with generated or otherwise dynamic includes. For whatever reason intellisense sometimes gets stuck with the old information. This might be because the symbol info gets cached and VS fails to properly recognize a file change or associate it with the right dependent source files. It works for me most of the time, but occasionally intellisense stops updating. As you mentioned this doesn't affect the compiler. It's just annoying because you get the red squiggles and wrong code suggestions.

      I don't have a solid fix, but a workaround I found working most of the time is forcing intellisense to reparse by changing something in the file that includes the generated ui_blah.h file. Just add a space at the top or something like that and save. If not I fiddle with the include or the ui member decalration, e.g. comment it out, save, uncomment, save. It also sometimes takes a couple of seconds until it "catches on" after that, especially if the project is big or file has a lot of includes.

      1 Reply Last reply
      2
      • Q Offline
        Q Offline
        Q74r3wq-
        wrote on last edited by
        #3

        Thanks, I'll try that next time! BTW how do I mark this as an answer?

        Chris KawaC 1 Reply Last reply
        0
        • Q Q74r3wq-

          Thanks, I'll try that next time! BTW how do I mark this as an answer?

          Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Q74r3wq said:

          BTW how do I mark this as an answer?

          Click on the three dots icon under the post you want to mark and select "Mark this post as the correct answer".

          Q 1 Reply Last reply
          0
          • Chris KawaC Chris Kawa

            @Q74r3wq said:

            BTW how do I mark this as an answer?

            Click on the three dots icon under the post you want to mark and select "Mark this post as the correct answer".

            Q Offline
            Q Offline
            Q74r3wq-
            wrote on last edited by
            #5

            @Chris-Kawa Somehow I don't see this option. Maybe because I'm a new user?

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved