Upgrading from Qt6.3.2 to Qt6.7.3 using Maintenance Tool not working for QML projects
-
I've been running Qt Creator 13.0.1, Based on Qt 6.6.3 (MSVC 2019, x86_64), Built on May 6 2024 00:14:45 using Kit: Qt 6.3.2 MinGW 64-bit. This has worked beautifully since last summer for over 400 tutorials and a few projects.
Now, I'm taking some Udemy classes on Qt6 QML and recently installed Qt6.7.3 MinGW 11.2.0 64-bit and tried to run some of the tutorials QML projects. I also created a new project using this new Kit: Qt6.7.3 MinGW 11.2.0 64-bit.
Unfortunately, none of the tutorials or new project created allow me to run them. They all have the Run and Debug buttons and all files grayed out.The Projects view shows all of the files/folders grayed out. Why?
I think this is a Configuration problem but not sure how to fix it.
Can you help? Thanks, JT -
@John-Trites said in Upgrading from Qt6.3.2 to Qt6.7.3 using Maintenance Tool not working for QML projects:
The Projects view shows all of the files/folders grayed out. Why?
Either the project was not configured for any kit or the kit itself is missing something.
Do new projects work? Are you able to create and run new QtWidget projects?Go to your project settings and check how it is configured.
To re-use older project, configured using old Qt kit, you should reset them by deleting everything except the actual code files
(everything which has the file extension.h
,.cpp
,.qml
,.qrc
,.pro
should stay, remove the rest, like temp. files or anypro.user
file)
When opening the project again, it should prompt you to configure the project again... select your new/current kit there. -
Pl45m4,
- All of my Qt Widgets (desktop) applications with the original Kit: Qt 6.3.2 MinGW 64-bit work successfully. No changes since I installed the new Qt6.7.3 MinGW 11.2.0 64-bit kit.
- I tried your suggestion of removing all files and folders for one of the QML 6 tutorial projects except for the CMakeLists.txt, main.cpp, and Main.qml files. Then reconfigured the project selecting the new Qt6.7.3 MinGW 11.2.0 64-bit kit. It came up with a new set of error messages that could not find some dependencies.
- So I tried creating a new Qt Quick Application selecting the new Qt6.7.3 MinGW 11.2.0 64-bit kit and it has the same grayed out Run button and project files as before.
- Finally, I tried creating a new Qt Quick Application selecting my old Qt6.3.2 MinGW 64-bit kit and it errored:
C:\Users\JohnTrites\Documents\Qt6\Qt6 QML\Qt6QMLForBeginnersVideo-main\qml6beg-mingw632-test\content\App.qml:5: error: Expected token;' C:\Users\JohnTrites\Documents\Qt6\Qt6 QML\Qt6QMLForBeginnersVideo-main\qml6beg-mingw632-test\content\Screen01.ui.qml:10: error: Expected token
;'
When I clicked on the errors, I found the first error msg wants a semicolon after the 2nd import
import QtQuick 6.2
import qml6beg-mingw632-test
I know this is not right. I don't know what to do at this point. Any other suggestions?
I appreciate your help, JT -
Are you able to run QtCreator's integrated QtWidget and QML examples with your 6.7 kit?
Go toProjects
tab on the left and select "Examples". Pick any QML and/or QtWidget example, configure it (click confirm/configure button in dialog) and try to run it.
If the examples work, your own projects are the issue and there is probably wrong code or a wrong configuration.
If the example do not work, the kit is not fully functional@John-Trites said in Upgrading from Qt6.3.2 to Qt6.7.3 using Maintenance Tool not working for QML projects:
It came up with a new set of error messages that could not find some dependencies.
What messages and errors exactly?
Post some of them below. -
Yes, I'm able to run one of the Qt Quick example calculators selecting the newly installed Qt6.7.3 MinGW 11.2.0 64-bit kit.
However, that one successful data app does not necessarily mean my code nor my Udemy instructor's many applications are programmed wrong or misconfigured. I configured many of the instructor's Qt6.6 Quick applications using the same newly installed Qt6.7.3 MinGW 11.2.0 64-bit kit and none of them work.
For example, 1-RectangleItemText loads without errors using the newly installed Qt6.7.3 MinGW 11.2.0 64-bit kit. But, when run has the following error messages:
C:\Users\JohnTrites\Documents\Qt6\Qt6 QML\Qt6QMLForBeginnersVideo-main\3.BasicElements\1-RectangleItemText\build\Desktop_Qt_6_7_3_MinGW_64_bit-Debug.qt\rcc\qrc_app1-RectangleItemText_raw_qml_0.cpp:156: error: opening dependency file CMakeFiles\app1-RectangleItemText.dir\51d3f1ba217d25c2b9aac7d1be159042\qrc_app1-RectangleItemText_raw_qml_0.cpp.obj.d: No such file or directory
C:/Users/JohnTrites/Documents/Qt6/Qt6 QML/Qt6QMLForBeginnersVideo-main/3.BasicElements/1-RectangleItemText/build/Desktop_Qt_6_7_3_MinGW_64_bit-Debug/.qt/rcc/qrc_app1-RectangleItemText_raw_qml_0.cpp:156:1: fatal error: opening dependency file CMakeFiles\app1-RectangleItemText.dir\51d3f1ba217d25c2b9aac7d1be159042\qrc_app1-RectangleItemText_raw_qml_0.cpp.obj.d: No such file or directory
156 | }
| ^C:\Users\JohnTrites\Documents\Qt6\Qt6 QML\Qt6QMLForBeginnersVideo-main\3.BasicElements\1-RectangleItemText\build\Desktop_Qt_6_7_3_MinGW_64_bit-Debug\app1-rectangleitemtext_qmltyperegistrations.cpp:22: error: expected unqualified-id before numeric constant
C:/Users/JohnTrites/Documents/Qt6/Qt6 QML/Qt6QMLForBeginnersVideo-main/3.BasicElements/1-RectangleItemText/build/Desktop_Qt_6_7_3_MinGW_64_bit-Debug/app1-rectangleitemtext_qmltyperegistrations.cpp:22:37: error: expected unqualified-id before numeric constant
22 | static const QQmlModuleRegistration 1RectangleItemTextRegistration("1-RectangleItemText", qml_register_types_1_RectangleItemText);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~C:\Users\JohnTrites\Documents\Qt6\Qt6 QML\Qt6QMLForBeginnersVideo-main\3.BasicElements\1-RectangleItemText\build\Desktop_Qt_6_7_3_MinGW_64_bit-Debug.rcc\qmlcache\app1-RectangleItemText_qmlcache_loader.cpp:58: error: opening dependency file CMakeFiles\app1-RectangleItemText.dir\ceb467afc0290ccc034ec2d3226023ef\app1-RectangleItemText_qmlcache_loader.cpp.obj.d: No such file or directory
C:/Users/JohnTrites/Documents/Qt6/Qt6 QML/Qt6QMLForBeginnersVideo-main/3.BasicElements/1-RectangleItemText/build/Desktop_Qt_6_7_3_MinGW_64_bit-Debug/.rcc/qmlcache/app1-RectangleItemText_qmlcache_loader.cpp:58:1: fatal error: opening dependency file CMakeFiles\app1-RectangleItemText.dir\ceb467afc0290ccc034ec2d3226023ef\app1-RectangleItemText_qmlcache_loader.cpp.obj.d: No such file or directory
58 | }
| ^:-1: error: ninja: build stopped: subcommand failed.
Any suggestions? JT
-
@John-Trites said in Upgrading from Qt6.3.2 to Qt6.7.3 using Maintenance Tool not working for QML projects:
However, that one successful data app does not necessarily mean my code nor my Udemy instructor's many applications are programmed wrong or misconfigured
What else should this mean?
If your kit is working with the example projects that come with Qt, your kit is set up correctly...
So the error must be located on your project's side.I'm not that much of a QML expert, but one issue (in general) is that your classes must not start with a numeric character...
It's definitely not allowed in C++ (doesn't matter if inside Qt Framework or just plain C/C++ code), not 100% sure for QML though...
[ Edit: same with QML. In addition for exported QML modules, even a-
(minus) is not allowed anywhere in the name. Use underscore or camel case instead ]@John-Trites said in Upgrading from Qt6.3.2 to Qt6.7.3 using Maintenance Tool not working for QML projects:
qrc_app1-RectangleItemText_raw_qml_0.cpp.obj.d: No such file or directory
However, because you have a
1-RectangleItemText.cpp
obj... I don't think it will work like this...Rename your class(es) and project(s) and try again...
(e.g.RectangleItemText_1
instead) -
Pl45m4,
So, I created a new version of my project named: qml6_4_20_customcomps in a folder: Qt6.6.3 Quick Projects on my Desktop.It now has two errors, the first one is:
C:\Users\JohnTrites\Desktop\Qt6.6.3 Quick Projects\qml6_4_20_customcomps\build\Desktop_Qt_6_6_3_MinGW_64_bit-Debug_deps\ds-build\src\imports\components\QuickStudioComponentsplugin_init_autogen\mocs_compilation.cpp:3: error: opening dependency file _deps\ds-build\src\imports\components\CMakeFiles\QuickStudioComponentsplugin_init.dir\9d777f3e334334a54a3cc379beec2ab9\mocs_compilation.cpp.obj.d: No such file or directory
C:/Users/JohnTrites/Desktop/Qt6.6.3 Quick Projects/qml6_4_20_customcomps/build/Desktop_Qt_6_6_3_MinGW_64_bit-Debug/_deps/ds-build/src/imports/components/QuickStudioComponentsplugin_init_autogen/mocs_compilation.cpp:3:47: fatal error: opening dependency file _deps\ds-build\src\imports\components\CMakeFiles\QuickStudioComponentsplugin_init.dir\9d777f3e334334a54a3cc379beec2ab9\mocs_compilation.cpp.obj.d: No such file or directory
3 | enum some_compilers { need_more_than_nothing };
| ^
So, I think it's looking for the QuickStudioComponentsplugin_init_autogen in the mocs compilation and can't find it.
Is this plugin available in the Qt Maintenance Tool or is it a separate download to install from the Qt website?
Or is there something else I'm missing?Btw, the demo Qt6.6.3 Quick examples run fine. An example of the calclatr example vs qml6_4_20_customcomps CMakeLists.txt files may provide more insight to the problem:
qml6_4_20_customcomps CMakeLists.txt file:
cmake_minimum_required(VERSION 3.21.1)
option(LINK_INSIGHT "Link Qt Insight Tracker library" ON)
option(BUILD_QDS_COMPONENTS "Build design studio components" ON)project(qml6_4_20_customcompsApp LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
find_package(Qt6 6.2 REQUIRED COMPONENTS Core Gui Qml Quick)
if (Qt6_VERSION VERSION_GREATER_EQUAL 6.3)
qt_standard_project_setup()
endif()qt_add_executable(qml6_4_20_customcompsApp src/main.cpp)
qt_add_resources(qml6_4_20_customcompsApp "configuration"
PREFIX "/"
FILES
qtquickcontrols2.conf
)target_link_libraries(qml6_4_20_customcompsApp PRIVATE
Qt6::Core
Qt6::Gui
Qt6::Qml
Qt6::Quick
)set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/qml)
set(QML_IMPORT_PATH ${QT_QML_OUTPUT_DIRECTORY}
CACHE STRING "Import paths for Qt Creator's code model"
FORCE
)if (BUILD_QDS_COMPONENTS)
include(${CMAKE_CURRENT_SOURCE_DIR}/qmlcomponents)
endif()include(${CMAKE_CURRENT_SOURCE_DIR}/qmlmodules)
if (LINK_INSIGHT)
include(${CMAKE_CURRENT_SOURCE_DIR}/insight)
endif ()include(GNUInstallDirs)
install(TARGETS qml6_4_20_customcompsApp
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)make IDEs aware of the QML import path
set(QML_IMPORT_PATH ${PROJECT_BINARY_DIR}/qml CACHE PATH
"Path to the custom QML components defined by the project")calclatr CMakeLists.txt file
cmake_minimum_required(VERSION 3.16)
project(calqlatr LANGUAGES CXX)set(CMAKE_AUTOMOC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/calqlatr")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick QuickControls2)
qt_add_executable(calqlatrexample WIN32 MACOSX_BUNDLE
main.cpp
)target_link_libraries(calqlatrexample PRIVATE
Qt6::Core
Qt6::Gui
Qt6::Qml
Qt6::Quick
Qt6::QuickControls2
)qt_add_qml_module(calqlatrexample
URI demos.calqlatr
VERSION 1.0
QML_FILES
"calqlatr.qml"
"content/Display.qml"
"content/NumberPad.qml"
"content/CalculatorButton.qml"
"content/calculator.js"
RESOURCES
"content/images/paper-edge-left.png"
"content/images/paper-edge-right.png"
"content/images/paper-grip.png"
RESOURCE_PREFIX /
)
if(ANDROID)
set_target_properties(calqlatrexample
PROPERTIES
QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android
QT_ANDROID_TARGET_SDK_VERSION "33")
endif()
if(IOS)
set(asset_catalog_path "ios/Assets.xcassets")
target_sources(calqlatrexample PRIVATE "${asset_catalog_path}")
set_source_files_properties(${asset_catalog_path} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set_target_properties(calqlatrexample
PROPERTIES XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon)
endif()install(TARGETS calqlatrexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)Any recommendations? Thank you, JT