QT_QML_NO_QML_PREVIEW (global property)

Controls whether qmlpreview support is automatically set up for executables linking against Qt6::Qml.

This variable was introduced in Qt 6.12.

By default, every executable target that links against Qt6::Qml automatically gets qmlpreview support set up for it at target finalization, as if qt_add_qml_preview() had been called on it explicitly. Executable targets that are themselves QML modules created by qt_add_qml_module() are unaffected, as they already get qmlpreview support from that command.

Setting this variable to a true value disables the automatic behavior for all targets. This skips the small amount of extra configure-time work spent creating a preview target for each executable, which is worthwhile for projects that don't use qmlpreview, for example applications that only drive QML through a QJSEngine for scripting, or release and CI builds where live reload is irrelevant. Disable it for an entire build by passing

 -DQT_QML_NO_QML_PREVIEW=ON

to the cmake executable, or set it in the project's CMakeLists.txt if preview is never needed.

For finer control, individual targets can opt out with the QT_QML_NO_QML_PREVIEW property, or opt back in with qt_add_qml_preview() even when preview is disabled globally.

See also qt_add_qml_preview() and QT_QML_NO_QML_PREVIEW.