MIT-licensed Qt bindings for Go
MIQT is MIT-licensed Qt bindings for Go.
This is a straightforward binding of the Qt 5.15 / Qt 6.4+ API using CGO. You must have a working Qt C++ development toolchain to use this Go binding.
These bindings were newly started in August 2024. The bindings are complete for QtCore, QtGui, QtWidgets, Qt SQL, QtMultimedia, QtMultimediaWidgets, QtSpatialAudio, QtPrintSupport, QtSvg, QtScript, QtNetwork, QtWebkit, QtWebChannel, QtWebEngine, QtCharts, QtPositioning, Qt Websockets, QStateMachine, QtUiPlugin/QtUiTools, QML, QScintilla, ScintillaEdit, Qwt, there is subclassing support, and there is a uic/rcc/lupdate implementation. But, the bindings may be immature in some ways. Please try out the bindings and raise issues if you have trouble.
| OS | Arch | Linkage | Status |
|---|---|---|---|
| Linux | x86_64 | Static or Dynamic (.so) | ✅ Works |
| Linux | ARM64 | Static or Dynamic (.so) | ✅ Works |
| Windows | x86_64 | Static or Dynamic (.dll) | ✅ Works |
| Android | ARM64 | Dynamic (bundled in .apk package) | ✅ Works |
| FreeBSD | x86_64 | Static or Dynamic (.so) | ✅ Works |
| macOS | x86_64 | Static or Dynamic (.dylib) | ✅ Works |
| macOS | ARM64 | Static or Dynamic (.dylib) | ✅ Works |
The MIQT Go bindings are licensed under the MIT license.
You must also meet your Qt license obligations.
These apps are listed in alphabetical order. Raise an issue or PR to have your app listed here!
MIQT is also used to produce Qt bindings to other programming languages:
Make sure to compile with go build -ldflags "-s -w". This reduces the helloworld example from 43MB to 6MB.
Then, it's possible to reduce the size further with upx --best to 2MB or upx --lzma to 1.4MB.
You can also try miqt-docker native -minify-build to use aggressive CFLAGS.
Yes. You must also meet your Qt license obligations: either use Qt dynamically-linked dll/so/dylib files under the LGPL, or, purchase a Qt commercial license for static linking.
The first time MIQT is used, your go build would take about 10 minutes. But after that, any go build is very fast.
Go 1.26 is significantly faster.
If you are compiling your app within a Dockerfile, you could cache the build step by running go install github.com/mappu/miqt/qt.
If you are compiling your app with a one-shot docker run command, the compile speed can be improved if you also bind-mount the Docker container's GOCACHE directory: -v $(pwd)/container-build-cache:/root/.cache/go-build. The miqt-docker helper app does this automatically.
See also issue #8.
qt 6.11.1 - warning: defining ‘QChar’, which previously failed to be complete in a SFINAE context
https://github.com/mappu/miqt/issues/335
Labels: bug, troubleshooting
Missing definition for QMenu.setAsDockMenu (macOS-only API)
https://github.com/mappu/miqt/issues/330
Labels: None
miqt-docker: add Qt6WebEngine Qt6WebChannel Qt6PrintSupport Qt6Network
https://github.com/mappu/miqt/issues/326
Labels: good first issue
No CONTRIBUTING document was found. Please check the README and open issues.