New UI widgets elements inaccessible to code model
-
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.