cutego/README.md

192 lines
5.2 KiB
Markdown
Raw Normal View History

# 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)
2016-08-14 19:53:08 +03:00
[source](http://github.com/therecipe/qt/blob/master/internal/examples/widgets/line_edits/line_edits.go)
---
# 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-08-14 19:53:08 +03:00
1. Install Go >= 1.6.2 and setup a proper [**GOPATH**](http://golang.org/doc/code.html#GOPATH)
* http://storage.googleapis.com/golang/go1.6.3.windows-amd64.msi
* http://storage.googleapis.com/golang/go1.6.3.darwin-amd64.pkg
* http://storage.googleapis.com/golang/go1.6.3.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/`
2016-08-14 19:53:08 +03:00
* http://download.qt.io/official_releases/qt/5.7/5.7.0/qt-opensource-windows-x86-android-5.7.0.exe
* http://download.qt.io/official_releases/qt/5.7/5.7.0/qt-opensource-mac-x64-android-5.7.0.dmg [(**with iOS**)](http://download.qt.io/official_releases/qt/5.7/5.7.0/qt-opensource-mac-x64-android-ios-5.7.0.dmg)
* http://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
* 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
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
---
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
2. Install the Android SDK in `C:\android\android-sdk\` or `/opt/android-sdk/`
2016-08-14 19:53:08 +03:00
* http://dl.google.com/android/android-sdk_r24.4.1-windows.zip
* http://dl.google.com/android/android-sdk_r24.4.1-macosx.zip
* http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
2014-12-02 23:51:56 +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-08-14 19:53:08 +03:00
* Android SDK Build-tools (24.0.1)
* Android 7.0 (API 24)
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
4. Install the Android NDK in `C:\android\android-ndk\` or `/opt/android-ndk/`
2016-08-14 19:53:08 +03:00
* http://dl.google.com/android/repository/android-ndk-r12b-windows-x86_64.zip
* http://dl.google.com/android/repository/android-ndk-r12b-darwin-x86_64.zip
* http://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip
2014-12-02 23:51:56 +03:00
5. Install Java SE Development Kit (Linux: install in `/opt/jdk/`)
2016-08-14 19:53:08 +03:00
* http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2014-12-02 23:51:56 +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`
---
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-08-14 19:53:08 +03:00
* http://download.virtualbox.org/virtualbox/5.1.2/VirtualBox-5.1.2-108956-Win.exe
* http://download.virtualbox.org/virtualbox/5.1.2/VirtualBox-5.1.2-108956-OSX.dmg
* http://download.virtualbox.org/virtualbox/5.1.2/VirtualBox-5.1.2-108956-Linux_amd64.run
2016-06-11 02:50:53 +03:00
3. Install the Sailfish OS SDK in `C:\SailfishOS\` or `/opt/SailfishOS/`
2016-08-14 19:53:08 +03:00
* http://releases.sailfishos.org/sdk/installers/1608/SailfishOSSDK-Beta-1608-Qt5-windows-offline.exe
* http://releases.sailfishos.org/sdk/installers/1608/SailfishOSSDK-Beta-1608-Qt5-mac-offline.dmg
* http://releases.sailfishos.org/sdk/installers/1608/SailfishOSSDK-Beta-1608-Qt5-linux-64-offline.run
2016-06-11 02:50:53 +03:00
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
1. Create a folder `[GOPATH]/src/qtExample`
2015-11-19 21:29:30 +03:00
2. Create a file `[GOPATH]/src/qtExample/main.go`
```go
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"
)
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()
}
```
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`
2016-08-14 19:53:08 +03:00
5. Take a look at the [other examples](http://github.com/therecipe/qt/tree/master/internal/examples)
2016-08-14 19:53:08 +03:00
6. Make yourself familiar with the [qt documentation](http://doc.qt.io/qt-5/classes.html)