Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
None
-
Qt Creator 7.0.2
-
None
Description
We recently restructured our project to use qt_add_qml_module in cmake instead of the large .qrc file we were using before. After the change all modules are still recognized properly, but following the symbol under cursor (using "F2") sends you to the file in the build directory instead of source.
Small example of how our project is currently structured:
myProject
- CMakeLists.txt
- main.cpp
- main.qml
- MyProject
- SecondScreen.qml
- ExtraModule
- CMakeLists.txt
- Extra.qml
- MySingleton.qml
- ExtraThing.h
- ExtraThing.cpp
- SecondModule
- CMakeLists.txt
- Second.qml
in the top level cmake file we add main.qml and SecondScreen as a module with the executable as backing target and load them in in main.cpp.
ExtraModule is then setup as:
// myProject/MyProject/ExtraModule/CMakeLists.txt
qt_add_library(myproject_extramodule STATIC)
set_source_files_properties(MySingleton.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
qt_add_qml_module(myproject_extramodule URI MyProject.ExtraModule VERSION 1.0 NO_PLUGIN QML_FILES Extra.qml MySingleton.qml SOURCES ExtraThing.cpp)
If I had this in my main.qml:
import MyProject.ExtraModule
import MyProject.SecondModule
Extra {
property int val: MySingleton.value
Second
}
Then pressing F2 with "Extra" selected sends you to build directory.
EDIT: I am using QtCreator 7.0.2 with Qt 6.3.1