forked from therecipe/qt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjni.go
executable file
·36 lines (27 loc) · 809 Bytes
/
jni.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"os"
"github.com/therecipe/qt/widgets"
)
func main() {
widgets.NewQApplication(len(os.Args), os.Args)
var (
window = widgets.NewQMainWindow(nil, 0)
vbox = widgets.NewQVBoxLayout2(nil)
button = widgets.NewQPushButton2("click me!", nil)
)
vbox.AddWidget(button, 0, 0)
println("are the java classes available?", Runnable__IsClassAvailable(), Runnable__IsQtClassAvailable())
var runner = NewQtRunnable()
runner.SetObjectName("java")
runner.ConnectRun(func() { println("hello from", runner.ObjectName()) })
button.ConnectClicked(func(checked bool) {
println("hello from go")
runner.Run()
})
var centralWidget = widgets.NewQWidget(window, 0)
centralWidget.SetLayout(vbox)
window.SetCentralWidget(centralWidget)
window.Show()
widgets.QApplication_Exec()
}