Qt binding for Go (Golang) aims get Go's compile speed again.
Switch branches/tags
Nothing to show
Clone or download
drswinghead
Latest commit 2a4c703 Sep 8, 2018
Permalink
Failed to load latest commit information.
.travis add install.md. use own version libdl gobinding. Mar 3, 2018
cmd Improve debug output. Improve cgo-rcc. Aug 22, 2018
docs Little doc and util for go side signal/slot mark. Sep 5, 2018
eg fix cross platform. add several travis ci. Feb 24, 2018
go-uic Move tools into their own directory, following Go best practices. Mar 23, 2018
qt5 move dirs. Jan 26, 2018
qtandroidextras Prepare go inherit qt class. Aug 31, 2018
qtandroidrt supply some lost functions for android. May 18, 2018
qtcore Prepare go inherit qt class. Aug 31, 2018
qtgui Prepare go inherit qt class. Aug 31, 2018
qtmacextras Prepare go inherit qt class. Aug 31, 2018
qtmeta Add 'qtmeta/' from commit 'f0447be0a2a90c0463055d61bd3ebf438f9cb3ce' Sep 8, 2018
qtmock import path to github, no local now. add readme and license. Feb 12, 2018
qtmultimedia Prepare go inherit qt class. Aug 31, 2018
qtnetwork Prepare go inherit qt class. Aug 31, 2018
qtpositioning Prepare go inherit qt class. Aug 31, 2018
qtprintsupport improve go-uic and makefile and dir2qrc command. Apr 14, 2018
qtqml Prepare go inherit qt class. Aug 31, 2018
qtqt Fix more go-uic. Add cgo-rcc. Add signal/slot connect destroy. Aug 12, 2018
qtquick Prepare go inherit qt class. Aug 31, 2018
qtquickcontrols2 add comment to api. fix go-uic. Mar 10, 2018
qtquicktemplates2 import path to github, no local now. add readme and license. Feb 12, 2018
qtquickwidgets Prepare go inherit qt class. Aug 31, 2018
qtrt Little doc and util for go side signal/slot mark. Sep 5, 2018
qtsvg Prepare go inherit qt class. Aug 31, 2018
qtwebchannel Prepare go inherit qt class. Aug 31, 2018
qtwebengine Prepare go inherit qt class. Aug 31, 2018
qtwebenginecore Prepare go inherit qt class. Aug 31, 2018
qtwebenginewidgets Prepare go inherit qt class. Aug 31, 2018
qtwidgets Prepare go inherit qt class. Aug 31, 2018
qtwinextras Prepare go inherit qt class. Aug 31, 2018
tests Add get enum/flags names by value. Aug 21, 2018
toolutil Improve debug output. Improve cgo-rcc. Aug 22, 2018
.gitignore Move tools into their own directory, following Go best practices. Mar 23, 2018
.travis.yml add osx tests. Mar 3, 2018
ChangeLog.md Update docs. Ready for rc4. Sep 8, 2018
Dockerfile.mingw fix cross platform. add several travis ci. Feb 24, 2018
Dockerfile.ubuntu16 add ubuntu16 ci. Feb 24, 2018
Gopkg.lock add install.md. use own version libdl gobinding. Mar 3, 2018
Gopkg.toml add install.md. use own version libdl gobinding. Mar 3, 2018
LICENSE import path to github, no local now. add readme and license. Feb 12, 2018
Makefile Improve debug output. Improve cgo-rcc. Aug 22, 2018
install.md Update docs. Ready for rc4. Sep 8, 2018
make.sh add install.md. use own version libdl gobinding. Mar 3, 2018
readme.md Update docs. Ready for rc4. Sep 8, 2018
run-mingw.sh add install.md. use own version libdl gobinding. Mar 3, 2018
run-ubuntu16.sh add install.md. use own version libdl gobinding. Mar 3, 2018

readme.md

qt.go

Qt5 binding for Go (Golang) without CGO that aims to achieve Go's native compile speeds. Instead of using common bindings and heavy C++ wrapper code that forces you to compile and link time and time again, Qt.Go uses FFI so there's only a runtime dependency.

Build Status Go Report Card GoDoc Sourcegraph

Features

  • Binding code with no CGO compile cost
  • Popular Qt5 packages (widgets/QML/extras) support
  • Simple go-uic, go-rcc tools
  • full signal/slot support
  • protected method override support
  • default arguments and value wrapper functions
  • Class/Method/Function/Enum comment for godoc
  • Go side signal/slot definition (experimental)

Multiple platforms support

All platforms should be supported, for now some of them are tested:

  • Archlinux/Ubuntu16+
  • MacOS
  • Android
  • Windows

Installation

requirement
  • go 1.9+
  • libffi
  • dlfcn (windows)
qt.go:
go get -v -u github.com/kitech/qt.go
runtime dependency:
git clone https://github.com/kitech/qt.inline.git
cd qt.inline
cmake .
make
cp libQt5Inline.so /usr/lib/libQt5Inline.so
FFI

Make sure libffi is installed

Debian based:

apt-get install libffi-dev

Arch based:

pacman -S libffi

Full Installation

Examples

package main
import "os"
import "github.com/kitech/qt.go/qtwidgets"
func main() {
    app := qtwidgets.NewQApplication(len(os.Args), os.Args, 0)
    btn := qtwidgets.NewQPushButton_1("hello qt.go", nil)
    btn.Show()
    app.Exec()
}

More complex examples: https://github.com/qtchina/qt.go.demos/

Go side signal/slot: syntax document usage demo

Internals

Qt.Go uses FFI to call wrapped Qt functions and methods, so there is no compile/link time dependency on Qt, only a run time dependency.

This should make the development and testing phases much faster.