Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
Qt Creator 11.0.0
-
None
-
Win11Pro x64, Qt 6.5.2, QtCreator 11.0.0, MingW_64 compiler (11.2.0), CMake 3.24.2 installed by Qt Creator
This is a fresh installation of Win11, QtCreator and all kits and all Qt parts were installed by the universal online installer.
Whether the clangd process is running or NOT does not seem to make any difference.Win11Pro x64, Qt 6.5.2, QtCreator 11.0.0, MingW_64 compiler (11.2.0), CMake 3.24.2 installed by Qt Creator This is a fresh installation of Win11, QtCreator and all kits and all Qt parts were installed by the universal online installer. Whether the clangd process is running or NOT does not seem to make any difference.
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
Issue Links
- duplicates
-
QTCREATORBUG-28787 No code completion for elements from .ui file in CMake project
- Closed