-
Install Go >= 1.6.2 and setup a proper GOPATH
-
Install Qt 5.6.0 in
C:\Qt\Qt5.6.0\
or/usr/local/Qt5.6.0/
-
Setup the environment
-
Windows
-
Add the directory that contains g++.exe to your PATH
C:\Qt\Qt5.6.0\Tools\mingw492_32\bin
-
-
Mac OS X
- Install Xcode >= 7.3.1
-
Linux
-
Install g++
sudo apt-get install g++
-
Install OpenGL dependencies
sudo apt-get install mesa-common-dev
-
-
-
Download the binding
go get github.com/therecipe/qt
-
Generate, install and test
cd %GOPATH%\src\github.com\therecipe\qt && setup.bat
(run as admin)or
cd $GOPATH/src/github.com/therecipe/qt && ./setup.sh
-
Set up the desktop version
-
Install the Android SDK in
C:\android\android-sdk\
or/opt/android-sdk/
-
Install the SDK dependencies with
C:\android\android-sdk\tools\android.bat
or/opt/android-sdk/tools/android
- Tools
- Android SDK Build-tools (23.0.3)
- Android 6.0 (API 23)
- SDK Platform
- Extras (Windows only)
- Google USB Driver
- Tools
-
Install the Android NDK in
C:\android\android-ndk\
or/opt/android-ndk/
-
Install Java SE Development Kit (Linux: install in
/opt/jdk/
) -
Install and test
cd %GOPATH%\src\github.com\therecipe\qt && setup.bat android
(run as admin)or
cd $GOPATH/src/github.com/therecipe/qt && ./setup.sh android
-
Set up the desktop version on Mac OS X
-
Install and test
cd $GOPATH/src/github.com/therecipe/qt && ./setup.sh ios && ./setup.sh ios-simulator
-
Set up the desktop version
-
Install VirtualBox
-
Install the Sailfish OS SDK in
C:\SailfishOS\
or/opt/SailfishOS/
-
Install and test
cd %GOPATH%\src\github.com\therecipe\qt && setup.bat sailfish && setup.bat sailfish-emulator
(run as admin)or
cd $GOPATH/src/github.com/therecipe/qt && ./setup.sh sailfish && ./setup.sh sailfish-emulator
-
Create a folder
[GOPATH]/src/qtExample
-
Create a file
[GOPATH]/src/qtExample/main.go
package main
import ( "os"
"github.com/therecipe/qt/widgets"
)
func main() { widgets.NewQApplication(len(os.Args), os.Args)
var btn = widgets.NewQPushButton2("Hello World", nil)
btn.Resize2(180, 44)
btn.ConnectClicked(func(flag bool) {
widgets.QMessageBox_Information(nil, "OK", "You Clicked me!", widgets.QMessageBox__Ok, widgets.QMessageBox__Ok)
})
var window = widgets.NewQMainWindow(nil, 0)
window.SetWindowTitle("Hello World Example")
window.Layout().AddWidget(btn)
window.Show()
widgets.QApplication_Exec()
}
3. Open the command line in `[GOPATH]/src` and run
`qtdeploy build desktop qtExample`
4. You will find the executable file here
`[GOPATH]/src/qtExample/deploy/[GOOS]/qtExample(.exe)`
5. Take a look at the [other examples](https://github.com/therecipe/qt/tree/master/internal/examples)
6. Make yourself familiar with the [qt documentation](https://doc.qt.io/qt-5/classes.html)