MIT-licensed Qt bindings for Go (mirror)
Go to file
mappu 1bd1b2b6fe doc/README: further information 2024-08-25 16:23:05 +12:00
cmd doc/README: update readme files 2024-08-25 16:06:16 +12:00
doc doc/logo: design a first logo 2024-08-19 19:42:41 +12:00
examples/helloworld go.mod: rename module 2024-08-25 16:05:48 +12:00
qt qt: generate for qt5.15.8+dfsg-11+deb12u2 2024-08-25 16:08:24 +12:00
.gitignore gitignore: prepare for initial commit 2024-08-25 16:06:48 +12:00
COPYING doc: add COPYING, README, TODO 2024-08-06 13:06:50 +12:00
README.md doc/README: further information 2024-08-25 16:23:05 +12:00
TODO doc/TODO: complete phase 0 2024-08-25 16:22:56 +12:00
go.mod go.mod: rename module 2024-08-25 16:05:48 +12:00

README.md

MIQT

MIT-licensed Qt bindings for Go.

This is a straightforward binding of the Qt API using CGO. You must have a working Qt C++ development toolchain to use this Go binding.

Project status

These bindings were newly started in August 2024. The bindings are functional for all of QtCore, QtGui, and QtWidgets. But, they may be immature in some ways. Please try out the bindings and raise issues if you have trouble. A detailed status is in the TODO file.

Supported platforms

Platform Linkage Status
Linux Static, Dynamic (.so) Works (Tested with Debian 12 / Qt 5.15 / Clang 14 / GCC 12)
Windows Static, Dynamic (.dll) Should work, not tested
macOS Static, Dynamic (.dylib) Should work, not tested

License

  • The Go bindings and tools in this repo are licensed under the MIT license
  • You must also meet your Qt license obligations.

FAQ

  1. Why are the binaries so big?

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.

  1. Can I release a proprietary, commercial app with this binding?

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.

  1. Why does it take so long to compile?

The first time the Qt bindings are compiled takes a long time. After this, it's fast. In a Dockerfile, you could cache the build step by running go install github.com/mappu/miqt.

  1. How does this compare to other Qt bindings?

MIQT is a clean-room binding that does not use any code from other Qt bindings.

  1. How does the MIQT Go API differ from the official Qt C++ API?

Most functions are implemented 1:1. The Qt documentation should be used.

The QString and QList<T> types are projected as plain Go string and []T. Therefore, you can't call any of QString/QList's helper methods, you must use some Go equivalent method instead.

Where Qt returns a C++ object by value (e.g. QSize), the binding may have moved it to the heap, and in Go this may be represented as a pointer type. In such cases, a Go finalizer is added to automatically delete the heap object. This means code using MIQT can look basically similar to the Qt C++ equivalent code.

Some C++ idioms that were difficult to project were omitted from the binding. But, this can be improved in the future.