Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-29465

CMake projects do not update code model when Widgets UI elements are added, deleted or renamed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • Qt Creator 11.0.0
    • C/C++/Obj-C++ Support
    • None
    • Windows

    Description

      When a traditional qmake Widgets project is built and a UI element is added, removed or it's name is changed, as soon as the .ui file is saved, the code model notices these changes.  Switching to the .cpp source allows full code completion immediately.

      When CMake is used to build a Widgets project and a UI element is added, removed or it's name is changed, the entire project must be built, closed and re-opened in order for the code model to notice the changes and provide code completion in the source code.

      STEPS TO REPRODUCE:

      WORKING NORMAL qmake

      Create a generic qmake project for a Widgets application.  Build the project.  Open the .ui file in Designer and add any UI component such as a QLabel or QPushButton.  Save the .ui file (Ctrl+S).  Now switch to the "mainwindow.cpp" source file for the UI and attempt to auto-complete some call to the newly added UI component, such as

      ui->label->setText("hello);

      During this operation you should see auto-completion somewhere around the "ui->lab" step of your typing.  This behavior is what I have experienced for the last 7 years of using QtCreator.

      NOT WORKING CMake

      Create a generic CMake project for a Widgets application.  Build the project.  Open the .ui file in Designer and add any UI component such as a QLabel or QPushButton.  Save the .ui file (Ctrl+S).  Now switch to the "mainwindow.cpp" source file for the UI and attempt to auto-complete some call to the newly added UI component, such as

      ui->label->setText("hello);

      Now there is no auto-completion on this newly added UI component.  If the user types in the new element function calls manually and correctly and builds the project, the project WILL build and work normally.
      ----------
      This issue is a detriment to the workflow when creating Widgets projects as one must complete the entire design of the UI before doing any coding at all (unless you can remember all of the UI elements by name, and some of mine have dozens).  I will commonly add a new UI component and immediately create the slot using Designer (context menu), which switches to the source for that new slot.  Code completion does not work when a CMake project.

      Attachments

        1. Plugins-1.png
          Plugins-1.png
          80 kB
        2. Plugins-2.png
          Plugins-2.png
          79 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              cadam Cristian Adam
              thirdstrand Mitch Wihnkle
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes