Handling incorrect warnings and a limited functionality in QML Code Editor in Qt Creator 14.0 and 15.0
December 16, 2024 by Sami Shalayel | Comments
We've recently discovered that the QML code editor in Qt Creator 14.0 and 15.0 is not working as expected out of the box. The QML Language Server integration is currently broken, and we’d like to address it openly and provide solutions for those affected.
The issue
Qt projects targeting Qt 6.8 have lots of warnings when opened in Qt Creator, despite still building and running fine. The problem was introduced while transitioning Qt Creator from the embedded codemodel to QML Language Server.
What happened?
In Qt Creator 14.0, we introduced the QML Language Server as the default mechanism for features such as warnings, autocompletion, and navigation (“Go to Definition”). While this modern integration offers numerous benefits, it relies on build folder information to resolve user-defined or custom QML modules. This information is essential for accurate imports and proper functionality.
Due to an oversight on our part, the necessary build folder data was not passed to the QML Language Server. As a result, many projects show incorrect warnings, and key features like autocompletion and navigation are not working as intended.
How does this impact you?
If you’re using Qt Creator 14.0 or 15.0 with projects that include custom or user-written QML modules:
- You may see incorrect warnings indicating that QML modules cannot be imported or that their properties, methods, or types are unresolved.
- Features like autocompletion and navigation may not function properly.
Even with the above issues, your projects will still build and run correctly. We will provide a permanent fix for these issues. The next section describes a workaround to improve your situation right now.
Workarounds
To mitigate this issue, we recommend the following workarounds until Qt Creator 16 is released:
Configure QML Language Server using QT_QML_GENERATE_QMLLS_INI
You can manually provide the missing build folder information to the QML Language Server via CMake. To achieve that:
- Go to
Projects
>Build
>CMake
>Add
- Create a
QT_QML_GENERATE_QMLLS_INI
variable, set it toON
, and pressRun CMake
- Restart the language Server
Note that QT_QML_GENERATE_QMLLS_INI
is not yet supported on Boot2Qt projects.
Revert to the embedded code model
You can enable the embedded code model by disabling QML Language Server in the Qt Creator settings,. This allows to use the older system for warnings, autocompletion, navigation, and other features, but has the drawback that some of the "real warnings" won't be shown in that case.
What’s next?
The upcoming Qt Creator 16.0 will include a reworked QML Language Server integration, ensuring that the necessary build folder information is passed correctly. This will restore functionality and resolve the current issues.
We are also reviewing our internal processes to ensure that such oversights will be identified as early as possible and avoided in the future so that they don't impact you as users.
Technical details
qmlls
instance across all projects. qmlls
is started as soon as a QML file is opened, and then keeps running until Qt Creator is exited. This is very impractical if each project needs to run qmlls
with its own set of command line parameters including the build folder, and therefore required deeper changes before being able to supply an actual fix. You can follow the current development of the new QML Language Server management code at QTCREATORBUG-31897, which includes passing the build folder to qmlls
.Thank You for Your Patience
We apologize for the inconvenience and confusion this issue may have caused. We greatly value your feedback and appreciate your understanding as we work to improve Qt Creator and deliver the experience you deserve.
If you have any questions or need further assistance, please don’t hesitate to reach out to us.
Blog Topics:
Comments
Subscribe to our newsletter
Subscribe Newsletter
Try Qt 6.8 Now!
Download the latest release here: www.qt.io/download.
Qt 6.8 release focuses on technology trends like spatial computing & XR, complex data visualization in 2D & 3D, and ARM-based development for desktop.
We're Hiring
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.