This is a port of the generated QtScript bindings used by QCAD, from Qt 5 to
Qt 6. It currently builds the qt.core, qt.gui, qt.network, qt.sql,
qt.widgets, qt.printsupport, qt.uitools, qt.xml, qt.svg, and qt.svgwidgets
QtScript extensions and the qs_eval functional-test executable with Qt
6.8.3 or newer on Windows/MSVC x64 and Linux/GCC x64. The evaluator is
linked to the ported QtScriptTools module and includes a headless debugger
attach/widget smoke test.
This repository contains the generated binding sources and the handwritten Qt 6 compatibility/build layer. It does not contain a Qt 6 port of the generator executable itself; API additions are maintained in the generated sources.
This port was developed with AI assistance under human planning and review, with every change verified by continuous integration.
The Qt 5 baseline came from QCAD's bundled
src/3rdparty/qt-labs-qtscriptgenerator-5.5.0 tree. QCAD's version-selector
projects through Qt 5.15.8 continued to build that shared binding tree. QCAD's
bundled readme credits
shibukawa/qtscriptgenerator,
a fork of the original Qt Labs Qt Script Generator.
This Qt 6 port keeps that history and includes the upstream LGPL license and Qt LGPL exception.
- Qt 6.8.3 or newer built for MSVC x64 or Linux x64.
- QtScript port for Qt 6,
installed as
Qt6::ScriptandQt6::ScriptToolswith CMake package metadata; qmake module metadata is also required when using the legacy nmake backend. - CMake 3.16 or newer (the minimum required by Qt 6.8).
- Windows: Visual Studio 2022 or newer with the x64 C++ toolchain.
- Linux: GCC with C++17 and Ninja.
- Windows uses Ninja Multi-Config by default; a Visual Studio generator can be selected explicitly when needed. Linux uses Ninja.
CI covers Release builds with Qt 6.8.3 LTS and Qt 6.11.1 on Windows and Linux.
From PowerShell:
.\build.ps1 -Configuration All
.\test.ps1 -Configuration Allbuild.ps1 uses CMake with Ninja Multi-Config by default. The existing
qmake/nmake build remains available explicitly:
.\build.ps1 -Backend NMake -Configuration AllCustom Qt locations can be selected without editing files:
.\build.ps1 -QtPrefix C:\Qt\my-qt6 -QtScriptPrefix C:\Qt\my-qtscript-overlayThe scripts also accept QT_ROOT_DIR and QTSCRIPT_PREFIX. If QtScript is
installed into the Qt prefix, only QT_ROOT_DIR is needed:
$env:QT_ROOT_DIR = 'C:\Qt\6.11.1\6.11.1\msvc2022_64'
.\build.ps1 -Generator "Ninja Multi-Config" -Configuration ReleaseThe Visual Studio generator can be selected explicitly:
.\build.ps1 -Generator "Visual Studio 17 2022" -Configuration AllOn Linux:
./build-linux.sh --qt-prefix "$QT_ROOT_DIR" --configuration Release
./test-linux.sh --qt-prefix "$QT_ROOT_DIR" --configuration ReleaseBoth scripts also accept --qt-script-prefix when QtScript is installed in a
separate prefix. If it is installed into the Qt prefix, only --qt-prefix is
needed.
The Linux script runs the functional binding smoke suite by default. Set
RUN_SCRIPTTOOLS_SMOKE=1 to include the debugger smoke; it is disabled in CI
because the current QtScriptTools port segfaults under GCC before the suite can
run. Windows CI covers that debugger path.
The plugins are written to plugins\script; Debug and Release evaluators are
written below qtbindings\qs_eval. test.ps1 runs smoke tests for core, GUI,
loopback Network, in-memory SQLite, offscreen widgets, PDF PrintSupport,
Designer UI, DOM XML parsing/manipulation, SVG rendering/generation, and SVG
Widgets through that evaluator.
Each module also has a regression smoke
script covering value conversion, overloads, state changes, and failure/cleanup
paths (for example, leap-day QDateTime arithmetic, transaction rollback,
model/view data, cookie parsing, PDF page geometry, and malformed .ui
handling).
Logs are written to logs; each evaluator process has a timeout so a binding
or cleanup hang is reported with its captured output. Use
-EvaluatorTimeoutMilliseconds with test.ps1 to adjust the default 120-second
per-process limit on slower machines.
The same run also constructs and attaches QScriptEngineDebugger, verifies a
debugger action and console widget, then detaches it without showing a window.
The port has no Qt5Compat build or runtime dependency. test.ps1 rejects
source references to it and inspects every selected plugin and evaluator
import table before running the functional tests.
The port does more than remove obsolete Qt 5 surface area. It also exports selected APIs introduced after Qt 5.15:
QRhiWidgetconstruction and its public configuration/framebuffer API (Qt 6.7), while its rendering callbacks remain native C++ extension points.QKeySequenceEdit, including the Qt 6 clear-button, maximum-length, and finishing-key-combination properties.QComboBox.LabelDrawingModeand its accessors (Qt 6.9).QFormLayoutrow visibility overloads (Qt 6.4).QGraphicsSceneEvent.timestampand the Qt 6 wheel-event pixel delta, scroll phase, and inversion API, together withQt.ScrollPhasevalues.- Newer
QStyleline-edit metrics and table/spin-box style hints. - Meta-object properties, slots, and signals added to existing QObject types,
including
QAbstractItemView.updateThreshold,QWidget.accessibleIdentifier,QDockWidget.dockLocation,QWizard.setCurrentId,QCheckBox.checkStateChanged, andQStackedWidget.widgetAdded. - Qt 6 GUI values such as
QFont.PreferTypoLineMetrics,QPainter.LosslessImageRendering,QPainter.VerticalSubpixelPositioning, andQPainter.NonCosmeticBrushPatterns. - Qt 6 SQL APIs including
QSqlError.nativeErrorCode, named bound-value inspection, andQSqlQuery.positionalBindingEnabled. - Qt 6 Network values including current HTTP/2/request-control attributes, TLS 1.3 and DTLS protocols, and EC/DH SSL key algorithms.
- Qt 6
QPrinter.copyCount()andsetCopyCount()alongside the retained Qt 5 copy-count API. QUiLoaderform loading against the Qt 6 widget set, including newer widget properties such asaccessibleIdentifier.- QtSvg's
QtSvg.Option/QtSvg.Optionsflags,QSvgRendererloading and raster rendering,QSvgGeneratoroutput, and the QtSvgWidgetsQSvgWidget/QGraphicsSvgItemclasses. - Qt XML DOM parsing through
QDomDocument, including Qt 6ParseOption/ParseOptionsand structuredParseResultdiagnostics, namespace-aware lookup, node cloning/import, and serialization. - Qt 6 date/time parity through the curated
QLocaleandQTimeZonevalue bindings,QDateTime'sfromSecsSinceEpoch/toSecsSinceEpochand time-zone conversion APIs,QDateTimeEdit.timeZone, plus locale code/BCP-47 and IANA-zone helpers. - Qt 6 input-event parity through
QEventcategory predicates, input-device metadata, modernQMouseEventpositions/lifecycle,QEventPointvalue construction/accessors, and syntheticQPointerEventpoint-list events, together with nativeQWheelEvent/QTabletEventpixel, phase, pressure, and tilt accessors.
tests\qt6-additions-smoke.js, tests\xml-smoke.js, and
tests\xml-regressions-smoke.js exercise these additions. Still deferred are
QStyleOptionHeaderV2 and script-implemented QRhiWidget
rendering hooks that would require exposing the QRhi integration types.
The Core, GUI, Network, SQL, XML DOM, Widgets, PrintSupport, UI Tools, SVG, and
SVG Widgets extensions
retain the generated Qt 5 script API where a direct Qt 6 equivalent exists.
Compatibility adapters cover Qt 6 metatypes and flags, QtScript QRegExp, a
local QStringConverter-backed QTextCodec facade, XML QStringView results,
container changes, and removed enum aliases. The XML extension intentionally
exposes the Qt 6 DOM module and its parse options/results while omitting the
removed SAX QXmlReader/QXmlInputSource family; QtCore's
QXmlStreamReader/QXmlStreamWriter bindings remain available.
QDate, QTime, and QDateTime return values on their QtScript QVariant
wrappers instead of Qt 6's built-in JavaScript-Date conversion, which preserves
the generated value prototypes during chained calls.
QLocale and QTimeZone are curated Qt 6 value bindings rather than a
mechanical Qt 5 surface dump: removed QStringRef overloads and obsolete
country/time-zone constructors are omitted, while locale-code, BCP-47, IANA,
fixed-offset, and QDateTime conversion paths are covered by regression tests.
Some removed APIs have constrained compatibility behavior:
QTextStream.setCodec()accepts encodings supported by Qt 6QStringConverter; unsupported legacy codecs raise a script error.QXmlStreamWriteris UTF-8-only in Qt 6; selecting another codec raises a script error.QSettings.setIniCodec()remains callable but is a no-op because Qt 6 INI files are UTF-8.- Removed
QLibraryInfoqueries andQCoreApplication.hasPendingEvents()raise explicit script errors. - Legacy
QTimestopwatch methods use wall-clockQTimearithmetic. - Removed
QTimeLine.CurveShapesymbolic values remain exported; Qt 6 usesQEasingCurveinternally. QPlainTextEdit.find(QRegExp)andQTextEdit.find(QRegExp)use a Qt 6QRegularExpression; uncommon legacyQRegExppattern modes may differ.- Removed
QTouchEventmutation methods remain callable as no-ops because Qt 6 touch-event data is immutable. - Legacy
QPrinterorientation, page-size, paper-name, margin, and copy-count methods are adapted to Qt 6QPageLayout,QPageSize, andcopyCount(). The removed Windows page-size ID methods raise explicit script errors.
Deferred core classes are QBasicTimer (move-only in Qt 6), QMutex's removed
recursive-mode constructor (the recursive type became QRecursiveMutex), and
the state-machine classes (the Qt 6 prefix used here does not contain
QtStateMachine).
Widget classes removed from Qt 6 are not exported: QDesktopWidget,
QGraphicsItemAnimation, QPictureFormatPlugin, QKeyEventTransition, and
QMouseEventTransition. QApplication is exported as a static-only facade;
the evaluator still provides the live qApp instance for instance-level use.
The GUI extension omits APIs removed without a direct Qt 6 equivalent:
QPictureIO, QRegExpValidator, and the generated legacy event constructor
for QTouchEvent.TouchPoint. QMatrix is kept as a source-compatible alias
backed by QTransform.
The SQL extension preserves the generated Qt 5 API across Qt 6 changes:
QSqlError.number() and its setter methods are backed by the string-based
native error code, and QSqlQuery.boundValues() reconstructs the legacy
name-to-value map from Qt 6's bound-value names and positional list. The newer
native error-code, bound-value-name, and positional-binding APIs are also
exported.
The Network extension omits the removed
QNetworkAccessManager.NetworkAccessibility bearer-management enum and the
obsolete SPDY request attributes. Legacy QSslSocket CA/cipher configuration
entry points are implemented through Qt 6 QSslConfiguration, and legacy
certificate path-pattern modes map to Qt 6 QSslCertificate.PatternSyntax.
The SVG plugin exposes both qt.svg and qt.svgwidgets keys. This preserves
the Qt 5 extension key while matching Qt 6's split between the QtSvg and
QtSvgWidgets libraries. The bindings cover the renderer/generator APIs and
the widget/graphics-item APIs; they intentionally keep the legacy QSvg
namespace as an alias of Qt 6's QtSvg namespace.
Qt WebKit and XMLPatterns was dropped from Qt 6 and is not supported by this project. Qt WebEngine bindings are not planned. The following original binding families are also out of scope:
- OpenGL and OpenGL Widgets.
- Multimedia and Multimedia Widgets.
- WebEngine bindings as a replacement for the old WebKit API.
- Generating bindings for additional Qt 6 modules.
The XMLPatterns, WebKit, and WebKitWidgets extensions were removed from Qt 6 and will not be ported by this project.