QML syntax support
CLion provides syntax support in .qml files for both Qt5 and Qt6. Find below a few examples of QML code insight features.
Highlighting and code completion for QML types and properties:
Find Usages for QML symbols can be invoked by pressing Alt+F7 or clicking the hint in the editor:
In the usages popup you can navigate between them and tune the search ():
Another navigation option is Structure View for the file contents. To open it, press Alt+7 or select from the main menu:
Quick Documentation popup is also available for QML symbols. Invoke it by hovering the mouse over a symbol or by pressing Control+Q:
Enable QML language server
Go to Enable QML language server checkbox.
and set theThis option enables QML-specific code inspections if there are
qmlls
components installed.Enable Use completion from QML language server to get language-server-based completion suggestions for QML symbols instead of those provided by CLion.
Qmlformat as code formatter
Qmlformat is enabled by default. If you prefer to turn it off, clear the Enable 'qmlformat' as formatter checkbox in .
When qmlformat is enabled, its indicator is shown in the bottom status bar. You can also disable qmlformat from there:
Troubleshooting: enable QML syntax support manually
Follow the steps below if you get the editor notification indicating that CLion could not find the Qt installation path or QML imports directory:
Check that
CMAKE_PREFIX_PATH
points to the Qt installation directory.Click CMake settings and add the following to CMake options:
-DCMAKE_PREFIX_PATH=your_qt_installationFor example:
In most cases, configuring CMake is enough for CLion to detect Qt and QML paths, however, if the notification is still there, you might need to set the paths manually. Click QML settings or go to to do so.
Known issues and limitations
QML support is CLion is currently a work in progress. The list of known issues include: