New UI widgets elements inaccessible to code model
-
This post is deleted!
This post is deleted! -
@Pl45m4 Ok is this a Qt5 vs. Qt6 issue then? I tested an older Qt5 project. I'll retest with a newer Qt6 qmake project and report back.
@ThirdStrand said in New UI widgets elements inaccessible to code model:
@Pl45m4 Ok is this a Qt5 vs. Qt6 issue then? I tested an older Qt5 project. I'll retest with a newer Qt6 qmake project and report back.
So I opened a qmake project and set the kit to Qt 6.5.2. I built it. Then I opened the main UI file and added a QLabel. Ctrl + S to save, Shift + F4 to go to the source code and the code model found the QLabel immediately. Same as happened in Qt5 qmake. AND THIS HAPPENS WITH THE clangd process running.
I cannot believe that I am the only one who has noticed this. Not being able to have code completion when adding UI elements severely slows down creation of UI projects.
-
@ThirdStrand said in New UI widgets elements inaccessible to code model:
@Pl45m4 Ok is this a Qt5 vs. Qt6 issue then? I tested an older Qt5 project. I'll retest with a newer Qt6 qmake project and report back.
So I opened a qmake project and set the kit to Qt 6.5.2. I built it. Then I opened the main UI file and added a QLabel. Ctrl + S to save, Shift + F4 to go to the source code and the code model found the QLabel immediately. Same as happened in Qt5 qmake. AND THIS HAPPENS WITH THE clangd process running.
I cannot believe that I am the only one who has noticed this. Not being able to have code completion when adding UI elements severely slows down creation of UI projects.
...
I cannot believe that I am the only one who has noticed this. Not being able to have code completion when adding UI elements severely slows down creation of UI projects.
INTERESTING:
The qmake project, when viewed in the "Tools/Debug QtCreator Code Model Inspector" (Ctrl+Shift+F12) shows both of my project's UI header files (ui_classname.h) as part of the Project Files tab.The cmake project with the same set of files, however, does NOT show them in the Project Files tab. If I explicitly add the ui_classname.h files to the cmake list of input files, there is no (discernable) activity when either of those two files change.
Next stop bug report unless someone has further information.
-
...
I cannot believe that I am the only one who has noticed this. Not being able to have code completion when adding UI elements severely slows down creation of UI projects.
INTERESTING:
The qmake project, when viewed in the "Tools/Debug QtCreator Code Model Inspector" (Ctrl+Shift+F12) shows both of my project's UI header files (ui_classname.h) as part of the Project Files tab.The cmake project with the same set of files, however, does NOT show them in the Project Files tab. If I explicitly add the ui_classname.h files to the cmake list of input files, there is no (discernable) activity when either of those two files change.
Next stop bug report unless someone has further information.
@ThirdStrand said in New UI widgets elements inaccessible to code model:
...
I cannot believe that I am the only one who has noticed this. Not being able to have code completion when adding UI elements severely slows down creation of UI projects.
INTERESTING:
...Next stop bug report unless someone has further information.
If clangd is turned off completely (confirmed not even running on the PC), the same behavior remains. Works in qmake, and doesn't work in cmake. This may have something to do with cmake and AUTOUIC perhaps????????
-
@ThirdStrand said in New UI widgets elements inaccessible to code model:
...
I cannot believe that I am the only one who has noticed this. Not being able to have code completion when adding UI elements severely slows down creation of UI projects.
INTERESTING:
...Next stop bug report unless someone has further information.
If clangd is turned off completely (confirmed not even running on the PC), the same behavior remains. Works in qmake, and doesn't work in cmake. This may have something to do with cmake and AUTOUIC perhaps????????
-
Hm... maybe somebody else will comment on this whole thing and possibly can reproduce it. Could be some weird config, could be a bug or some unhandled behavior...
Good luck ;-)Yes, I am of the same hopes. Bear in mind also that this is a fresh Win11Pro PC, a freshly installed QtCreator 11.0.0 and the universal installer downloaded and installed all of the kits. Totally stock standard Qt.
-
C Christian Ehrlicher moved this topic from General and Desktop on
-
@Christian-Ehrlicher Thanks for moving this topic around in attempts to get visibility. Much appreciated.
-
For the record as no noise here yet:
-
For the record as no noise here yet:
@ThirdStrand Have you noticed it is marked "Duplicate" of https://bugreports.qt.io/browse/QTCREATORBUG-28787 ?
-
and ::
https://bugreports.qt.io/browse/QTCREATORBUG-28787
appears to have been reported this past February.
-
The CMake project using
AUTOUIC
set toON
do not work.But if you don't use
AUTOUIC
it works as expected.I've changed a
hello-widgets-cmake
project like this:#set(CMAKE_AUTOUIC ON) qt_wrap_ui(UI_SRC mainwindow.ui) set(PROJECT_SOURCES main.cpp mainwindow.cpp mainwindow.h ${UI_SRC} ) target_include_directories(hello-widgets-cmake PRIVATE ${CMAKE_BINARY_DIR})
And got it working for me.
-
The CMake project using
AUTOUIC
set toON
do not work.But if you don't use
AUTOUIC
it works as expected.I've changed a
hello-widgets-cmake
project like this:#set(CMAKE_AUTOUIC ON) qt_wrap_ui(UI_SRC mainwindow.ui) set(PROJECT_SOURCES main.cpp mainwindow.cpp mainwindow.h ${UI_SRC} ) target_include_directories(hello-widgets-cmake PRIVATE ${CMAKE_BINARY_DIR})
And got it working for me.
@cristian-adam Thank you for the follow-up. I was reading about this old way yesterday, but I was not sure if it would make any difference.
Noting that CMake mark that generic command "qt_wrap_ui" as deprecated.
One should use qt6_wrap_ui which is supposedly provided by the Qt installation of CMake. (or the qt5 variant as required)
I will experiment with this in the meantime, and it appears promising!, while waiting for an official word from the Bug Report. If AUTOUIC is not terribly useful in it's current state, I am in hopes that it will be "fixed" to do what this manual qt6_wrap_ui accomplishes.
-
Confirming changing to the qt6_wrap_ui method seems to work "normally". The bug under which mine was closed as a duplicate shows Fixed on the Kanban board, so looking forward to finding out soon.
-
T ThirdStrand has marked this topic as solved on
-
Confirming changing to the qt6_wrap_ui method seems to work "normally". The bug under which mine was closed as a duplicate shows Fixed on the Kanban board, so looking forward to finding out soon.
The bug is fixed. You could get binaries from https://github.com/qt-creator/qt-creator/actions/runs/5763934496 when the job is done.
Or wait until the fix landed in https://download.qt.io/snapshots/qtcreator/11.0/
-
Additional note:
I built a new CMake file (using a file from another project and editing it) for an existing qmake project and attempted to build it. All components built until it got to building the UI. For some unknown reason, the resulting "ui_mainwindows.h" file, which is in it's normal place in the build folder was not found by CMake.
I changed CMake to turning on AUTOUIC and it built properly. Then changed it back to the qt6_wrap_ui method and it continues to build properly.