2015-12-06 02:56:16 +03:00
|
|
|
# Screenshots
|
|
|
|
|
|
|
|
## Windows
|
|
|
|
![](internal/screens/windows.png)
|
|
|
|
|
|
|
|
## Mac OS X
|
|
|
|
![](internal/screens/mac.png)
|
|
|
|
|
|
|
|
## Linux
|
|
|
|
![](internal/screens/linux.png)
|
|
|
|
|
|
|
|
## Android
|
|
|
|
|
|
|
|
### Portrait
|
|
|
|
![](internal/screens/android_portrait.png)
|
|
|
|
|
|
|
|
### Landscape
|
|
|
|
![](internal/screens/android_landscape.png)
|
|
|
|
|
2016-05-15 23:07:05 +03:00
|
|
|
## iOS
|
|
|
|
|
|
|
|
### Portrait
|
|
|
|
![](internal/screens/ios_portrait.png)
|
|
|
|
|
|
|
|
### Landscape
|
|
|
|
![](internal/screens/ios_landscape.png)
|
|
|
|
|
2016-06-11 02:50:53 +03:00
|
|
|
## Sailfish OS
|
|
|
|
|
|
|
|
![](internal/screens/sailfish_portrait.png)
|
|
|
|
|
2015-12-16 15:51:53 +03:00
|
|
|
[source](https://github.com/therecipe/qt/blob/master/internal/examples/widgets/line_edits/line_edits.go)
|
2015-12-06 02:56:16 +03:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
# Getting Started
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2016-06-11 02:50:53 +03:00
|
|
|
## Windows / Mac OS X / Linux
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2016-05-15 23:07:05 +03:00
|
|
|
1. Install Go >= 1.6.2 and setup a proper [**GOPATH**](https://golang.org/doc/code.html#GOPATH)
|
2016-04-28 20:43:44 +03:00
|
|
|
* https://storage.googleapis.com/golang/go1.6.2.windows-amd64.msi
|
|
|
|
* https://storage.googleapis.com/golang/go1.6.2.darwin-amd64.pkg
|
|
|
|
* https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2016-06-16 18:49:55 +03:00
|
|
|
2. Install Qt 5.7.0 in `C:\Qt\Qt5.7.0\` or `/usr/local/Qt5.7.0/`
|
|
|
|
* https://download.qt.io/official_releases/qt/5.7/5.7.0/qt-opensource-windows-x86-android-5.7.0.exe
|
|
|
|
* https://download.qt.io/official_releases/qt/5.7/5.7.0/qt-opensource-mac-x64-android-5.7.0.dmg [(**with iOS**)](https://download.qt.io/official_releases/qt/5.7/5.7.0/qt-opensource-mac-x64-android-ios-5.7.0.dmg)
|
|
|
|
* https://download.qt.io/official_releases/qt/5.7/5.7.0/qt-opensource-linux-x64-android-5.7.0.run
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
3. Setup the environment
|
|
|
|
* Windows
|
2016-05-15 23:07:05 +03:00
|
|
|
* Add the directory that contains **g++.exe** to your **PATH**
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2016-06-16 18:49:55 +03:00
|
|
|
`C:\Qt\Qt5.7.0\Tools\mingw530_32\bin`
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
* Mac OS X
|
2016-05-15 23:07:05 +03:00
|
|
|
* Install Xcode >= 7.3.1
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
* Linux
|
2015-12-06 02:56:16 +03:00
|
|
|
* Install g++
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
`sudo apt-get install g++`
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
* Install OpenGL dependencies
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
`sudo apt-get install mesa-common-dev`
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2015-12-06 02:56:16 +03:00
|
|
|
4. Download the binding
|
2015-11-09 20:23:42 +03:00
|
|
|
|
|
|
|
`go get github.com/therecipe/qt`
|
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
5. Generate, install and test
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2016-06-11 03:01:42 +03:00
|
|
|
`cd %GOPATH%\src\github.com\therecipe\qt && setup.bat` **(run as admin)**
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2016-06-11 03:01:42 +03:00
|
|
|
or
|
2015-11-09 20:23:42 +03:00
|
|
|
|
2016-06-11 03:01:42 +03:00
|
|
|
`cd $GOPATH/src/github.com/therecipe/qt && ./setup.sh`
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2015-12-06 02:56:16 +03:00
|
|
|
---
|
|
|
|
|
2016-06-11 02:50:53 +03:00
|
|
|
## Android
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2016-05-15 23:07:05 +03:00
|
|
|
1. Set up the desktop version
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2015-12-06 02:56:16 +03:00
|
|
|
2. Install the Android SDK in `C:\android\android-sdk\` or `/opt/android-sdk/`
|
2016-05-11 16:33:24 +03:00
|
|
|
* https://dl.google.com/android/android-sdk_r24.4.1-windows.zip
|
2015-12-06 02:56:16 +03:00
|
|
|
* https://dl.google.com/android/android-sdk_r24.4.1-macosx.zip
|
|
|
|
* https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2015-12-06 02:56:16 +03:00
|
|
|
3. Install the SDK dependencies with `C:\android\android-sdk\tools\android.bat` or `/opt/android-sdk/tools/android`
|
2015-11-09 20:23:42 +03:00
|
|
|
* Tools
|
2016-06-25 20:55:12 +03:00
|
|
|
* Android SDK Build-tools (24.0.0)
|
2016-05-26 00:13:17 +03:00
|
|
|
* Android 6.0 (API 23)
|
2015-11-09 20:23:42 +03:00
|
|
|
* SDK Platform
|
2015-11-12 03:29:32 +03:00
|
|
|
* Extras (Windows only)
|
|
|
|
* Google USB Driver
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2015-12-06 02:56:16 +03:00
|
|
|
4. Install the Android NDK in `C:\android\android-ndk\` or `/opt/android-ndk/`
|
2016-06-25 20:55:12 +03:00
|
|
|
* https://dl.google.com/android/repository/android-ndk-r12-windows-x86_64.zip
|
|
|
|
* https://dl.google.com/android/repository/android-ndk-r12-darwin-x86_64.zip
|
|
|
|
* https://dl.google.com/android/repository/android-ndk-r12-linux-x86_64.zip
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2016-05-19 22:28:54 +03:00
|
|
|
5. Install Java SE Development Kit (Linux: install in `/opt/jdk/`)
|
2015-12-06 02:56:16 +03:00
|
|
|
* https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2016-05-19 22:28:54 +03:00
|
|
|
6. Install and test
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2016-06-11 03:01:42 +03:00
|
|
|
`cd %GOPATH%\src\github.com\therecipe\qt && setup.bat android` **(run as admin)**
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2016-06-11 03:01:42 +03:00
|
|
|
or
|
2014-12-02 23:51:56 +03:00
|
|
|
|
2016-06-11 03:01:42 +03:00
|
|
|
`cd $GOPATH/src/github.com/therecipe/qt && ./setup.sh android`
|
2015-11-15 14:50:04 +03:00
|
|
|
|
2015-12-06 02:56:16 +03:00
|
|
|
---
|
|
|
|
|
2016-06-11 02:50:53 +03:00
|
|
|
## iOS
|
2016-05-15 23:07:05 +03:00
|
|
|
|
|
|
|
1. Set up the desktop version on Mac OS X
|
|
|
|
|
|
|
|
2. Install and test
|
|
|
|
|
2016-06-11 03:01:42 +03:00
|
|
|
`cd $GOPATH/src/github.com/therecipe/qt && ./setup.sh ios && ./setup.sh ios-simulator`
|
2016-05-15 23:07:05 +03:00
|
|
|
|
|
|
|
---
|
|
|
|
|
2016-06-11 02:50:53 +03:00
|
|
|
## Sailfish OS
|
|
|
|
|
|
|
|
1. Set up the desktop version
|
|
|
|
|
|
|
|
2. Install VirtualBox
|
2016-06-17 20:58:43 +03:00
|
|
|
* http://download.virtualbox.org/virtualbox/5.0.22/VirtualBox-5.0.22-108108-Win.exe
|
|
|
|
* http://download.virtualbox.org/virtualbox/5.0.22/VirtualBox-5.0.22-108108-OSX.dmg
|
|
|
|
* http://download.virtualbox.org/virtualbox/5.0.22/VirtualBox-5.0.22-108108-Linux_amd64.run
|
2016-06-11 02:50:53 +03:00
|
|
|
|
|
|
|
3. Install the Sailfish OS SDK in `C:\SailfishOS\` or `/opt/SailfishOS/`
|
|
|
|
* http://releases.sailfishos.org/sdk/installers/1602/SailfishOSSDK-Beta-1602-Qt5-windows-offline.exe
|
|
|
|
* http://releases.sailfishos.org/sdk/installers/1602/SailfishOSSDK-Beta-1602-Qt5-mac-offline.dmg
|
|
|
|
* http://releases.sailfishos.org/sdk/installers/1602/SailfishOSSDK-Beta-1602-Qt5-linux-64-offline.run
|
|
|
|
|
|
|
|
4. Install and test
|
|
|
|
|
2016-06-11 03:01:42 +03:00
|
|
|
`cd %GOPATH%\src\github.com\therecipe\qt && setup.bat sailfish && setup.bat sailfish-emulator` **(run as admin)**
|
2016-06-11 02:50:53 +03:00
|
|
|
|
2016-06-11 03:01:42 +03:00
|
|
|
or
|
2016-06-11 02:50:53 +03:00
|
|
|
|
2016-06-11 03:01:42 +03:00
|
|
|
`cd $GOPATH/src/github.com/therecipe/qt && ./setup.sh sailfish && ./setup.sh sailfish-emulator`
|
2016-06-11 02:50:53 +03:00
|
|
|
|
|
|
|
---
|
|
|
|
|
2015-11-19 21:29:30 +03:00
|
|
|
# Quick Start
|
|
|
|
|
2015-12-06 02:56:16 +03:00
|
|
|
1. Create a folder `[GOPATH]/src/qtExample`
|
2015-11-19 21:29:30 +03:00
|
|
|
|
2015-12-06 02:56:16 +03:00
|
|
|
2. Create a file `[GOPATH]/src/qtExample/main.go`
|
2015-12-15 04:01:51 +03:00
|
|
|
```go
|
2015-11-15 14:50:04 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-12-18 21:03:39 +03:00
|
|
|
"os"
|
2015-11-19 21:29:30 +03:00
|
|
|
|
2015-12-18 21:03:39 +03:00
|
|
|
"github.com/therecipe/qt/widgets"
|
2015-11-15 14:50:04 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2015-12-18 21:03:39 +03:00
|
|
|
widgets.NewQApplication(len(os.Args), os.Args)
|
2015-11-19 21:29:30 +03:00
|
|
|
|
2015-12-18 21:03:39 +03:00
|
|
|
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)
|
|
|
|
})
|
2015-11-19 21:29:30 +03:00
|
|
|
|
2015-12-18 21:03:39 +03:00
|
|
|
var window = widgets.NewQMainWindow(nil, 0)
|
|
|
|
window.SetWindowTitle("Hello World Example")
|
|
|
|
window.Layout().AddWidget(btn)
|
|
|
|
window.Show()
|
2015-11-19 21:29:30 +03:00
|
|
|
|
2015-12-18 21:03:39 +03:00
|
|
|
widgets.QApplication_Exec()
|
2015-11-15 14:50:04 +03:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2015-12-06 02:56:16 +03:00
|
|
|
3. Open the command line in `[GOPATH]/src` and run
|
2015-11-19 21:29:30 +03:00
|
|
|
`qtdeploy build desktop qtExample`
|
|
|
|
|
2016-06-16 18:49:55 +03:00
|
|
|
4. You will find the binary file here
|
|
|
|
`[GOPATH]/src/qtExample/deploy/[GOOS]/qtExample`
|
2015-12-06 02:56:16 +03:00
|
|
|
|
|
|
|
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)
|