Important
A modernized QtScript ditching JSC in favor of QuickJS-NG is work-in-progress in the following branch https://github.com/JulienMaille/qtscript-qt6/tree/quickjs-modernize
Note
Looking for a compatible port of qtscriptgenerator?
This repository provides the patches needed to build the QtScript core module and the ScriptTools debugger module with Qt 6 on Windows x64/MSVC, Linux x64/GCC, and macOS Apple Silicon/Apple Clang. Qt 6.8 LTS (6.8.3) is the baseline. CI also covers the latest 6.11.x on all three platforms.
QtScript source is not vendored. The build script clones KDE's QtScript
5.15.19 revision, copies the Qt 6 CMake entry point from cmake,
and applies the ordered files in patches.
- Builds Debug and Release variants of
Qt6::ScriptandQt6::ScriptTools. - Installs alongside the other Qt modules, like the Qt 5 module did.
- Preserves the public
QScript*source API. Qt 5 binary compatibility is not supported. - Ports the ScriptTools debugger (
QScriptEngineDebugger, script/console/ breakpoint widgets, completion and error reporting) with itsscripttools_debuggingresources. - Does not depend on Core5Compat.
- Passes ~20 checks in the external CMake smoke test: evaluation, calls,
exceptions,
QVariant,QRegExpcompatibility, and QObject exposure with enum conversion and signals. Seedocs/VALIDATION.mdfor full results. - CI builds the ported upstream suites on every matrix job and executes
them via a dedicated
cteststep on each Debug job. - Fixes the inherited QtScript
INT32_MINnegation bug tracked asQTBUG-32829.
Legacy QRegExp signatures use QtScript/QRegExp, implemented with Qt 6
QRegularExpression. Regular-expression, wildcard, fixed-string, capture, and
replacement behaviors are supported. This compatibility API is compiled in by
default and can be disabled with -DSCRIPT_QREGEXP=OFF.
See docs/PORTING.md for the patch inventory.
This port was developed with AI assistance under human planning and review, with every change verified by continuous integration.
- CMake 3.16 or newer; qmake is not supported.
- Windows: Visual Studio 2022 or newer with the MSVC x64 C++ toolchain (CMake auto-detects the newest installed; CI exercises MSVC 2022 on the LTS leg and MSVC 2026 on the latest-Qt leg).
- Linux: GCC (C++17) and Ninja.
- macOS: Apple Clang and Ninja on Apple Silicon.
- A supported Qt 6.8 through Qt 6.11 installation with private module build tooling
(
qt-cmake-private,qtpaths).
On Windows:
.\scripts\build-windows.ps1 -QtRoot C:\Qt\6.8.3\msvc2022_64 -Configuration ReleaseOn Linux:
./scripts/build-linux.sh --qt-root "$HOME/Qt/6.8.3/gcc_64" --configuration ReleaseOn macOS, install into an isolated prefix (universal arm64;x86_64
frameworks):
./scripts/build-macos.sh \
--qt-root "$HOME/Qt/6.8.3/macos" \
--install-prefix "$PWD/.work/qtscript-install" \
--configuration ReleaseThe script clones the 5.15.19 sources, applies the patch series, builds, and
installs both modules into the Qt prefix using the same layout the Qt 5
module used: headers under include\QtScript and include\QtScriptTools,
CMake packages under lib\cmake\Qt6Script and lib\cmake\Qt6ScriptTools, binaries in
bin/lib, and module registration under mkspecs\modules. It then runs an
out-of-tree CMake smoke build that compiles and runs against the installed
modules.
QtScript embeds a legacy 2011 JavaScriptCore snapshot. It is not a security
sandbox; run only trusted scripts. See SECURITY.md.
QtScript and patched source retain their upstream licenses. License texts are
included in LICENSES.