From 7bb49eabdf8d86567660c8825892eb323fa6e674 Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Wed, 25 Feb 2026 16:11:53 +0100 Subject: Add .qmlformat.ini, qmlls support, and format QML files - Enable QT_QML_GENERATE_QMLLS_INI for QML Language Server support - Add IMPORT_PATH to demo's qt_add_qml_module so .qmlls.ini includes the local build QML directory alongside the Qt system path - Add editor setup section to README with qmlls and qmlformat guidance - Add QML formatting section to French guide - Reformat demo QML files with .qmlformat.ini (line wrapping at 80 cols) --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index a396945..0d679bf 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,29 @@ target_compile_definitions(YourApp PRIVATE QTOPCUA_PLUGIN_PATH="${QTOPCUA_INSTALL_DIR}/plugins") ``` +## Editor setup (QML Language Server) + +The build generates `.qmlls.ini` files so that qmlls can resolve both Qt and local Bobink QML imports. + +**Neovim** — works out of the box if your LSP config picks up qmlls. + +**Qt Creator** — enable the language server under Edit > Preferences > Language Client > QML Language Server. + +**QML formatting** — a `.qmlformat.ini` is included at the project root. `qmlformat` picks it up automatically from the terminal (`qmlformat -i file.qml`). Qt Creator does not respect `.qmlformat.ini` or its own Code Style settings when formatting ([QTCREATORBUG-29668](https://bugreports.qt.io/browse/QTCREATORBUG-29668)) — use the command line instead. + +**Submodule users** — since `QT_QML_GENERATE_QMLLS_INI` and the demo are only enabled for top-level builds, add these to your own project: + +```cmake +# Enable .qmlls.ini generation +set(QT_QML_GENERATE_QMLLS_INI ON CACHE BOOL "") + +# Add the build QML directory so qmlls can resolve the Bobink import +qt_add_qml_module(YourApp + URI YourApp + ... + IMPORT_PATH "${CMAKE_BINARY_DIR}/qml") +``` + ## Project structure ``` -- cgit v1.2.3