Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chai2010/qml
Qt/QML for Golang (fork from go-qml/qml.v1), Qt/MSVC with Win32/Win64.
https://github.com/chai2010/qml
Last synced: 3 months ago
JSON representation
Qt/QML for Golang (fork from go-qml/qml.v1), Qt/MSVC with Win32/Win64.
- Host: GitHub
- URL: https://github.com/chai2010/qml
- Owner: chai2010
- Created: 2014-09-11T07:20:34.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-11T08:31:49.000Z (about 10 years ago)
- Last Synced: 2024-10-06T01:18:57.007Z (3 months ago)
- Language: Go
- Homepage: http://godoc.org/github.com/chai2010/qml
- Size: 3.27 MB
- Stars: 10
- Watchers: 3
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Go bindings for Qt5/QML
=======================PkgDoc: [http://godoc.org/github.com/chai2010/qml](http://godoc.org/github.com/chai2010/qml)
Install
=======Install `Go1.4` and `Qt5` and `GCC` ([`MinGW` download here](http://tdm-gcc.tdragon.net/download)) at first.
If Qt5 is [`Visual Studio`](http://msdn.microsoft.com/en-us/vstudio/aa718325.aspx) version (windows only), also need install
[`Visual Studio`](http://msdn.microsoft.com/en-us/vstudio/aa718325.aspx).
Then run these commands:1. set `$(QTDIR)` and add `$(QTDIR)/bin` to `$(PATH)`
2. `go get -d github.com/chai2010/qml`
3. `go generate` and `go install`
4. `go run hello.go`
Install `opengl-x.y`: `go generate github.com/chai2010/qml/gl/x.y`.**Note**
If use Go1.3, should run `cmd /c call internal\goqml\build_msvc.bat`(windows) or `cd internal/goqml && make -f Makefile.posix` istead of `go generate`.
See:
- http://tip.golang.org/cmd/go/#hdr-Generate_Go_files_by_processing_source
- https://github.com/chai2010/qml/blob/master/generate_windows.go
- https://github.com/chai2010/qml/blob/master/generate_generic.goExample
=======```Go
package mainimport (
"fmt"
"os""github.com/chai2010/qml"
)func main() {
if err := qml.Run(run); err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
}
}func run() error {
engine := qml.NewEngine()
engine.On("quit", func() { os.Exit(0) })component, err := engine.LoadString("hello.qml", qmlHello)
if err != nil {
return err
}
window := component.CreateWindow(nil)
window.Show()
window.Wait()
return nil
}const qmlHello = `
import QtQuick 2.0Rectangle {
id: page
width: 320; height: 240
color: "lightgray"Text {
id: helloText
text: "Hello world!"
y: 30
anchors.horizontalCenter: page.horizontalCenter
font.pointSize: 24; font.bold: true
}
}
`
```Screenshots
===========**Hello**
[![](https://raw.githubusercontent.com/chai2010/qml/master/screenshot/windows/hello.jpg)](https://github.com/chai2010/qml/blob/master/examples/hello/main.go)
**Clocks**
[![](https://raw.githubusercontent.com/chai2010/qml/master/screenshot/windows/clocks.png)](https://github.com/chai2010/qml/blob/master/examples/clocks/main.go)
**SameGame**
[![](https://raw.githubusercontent.com/chai2010/qml/master/screenshot/windows/samegame.png)](https://github.com/chai2010/qml/tree/master/examples/samegame)
BUGS
====Report bugs to .
Thanks!